Billing Cost Center Assignment
A list of billable resources with the internal cost center each one is attributed to, plus its GL code. Resources without a cost center are highlighted and rolled up into an unassigned count badge in the header. Built for finance admin screens where someone needs to see, at a glance, which spend still needs to be attributed to a department before month-end close.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/billing-cost-center-assignment.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/billing/billing38.tsx instead.
Usage
The file also exports billing38Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Billing38, billing38Demo } from "@/components/blocks/billing/billing38"; export default function Page() { return <Billing38 {...billing38Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Cost center assignment" | Heading in the panel's top bar. |
| description | string | none | Optional supporting line under the heading. |
| assignments | CostCenterAssignment[] | none | Resource rows rendered as-is, in the order given. |
| className | string | none | Extra classes for the outer container. |
Types
interface CostCenterAssignment { id: string; resourceName: string; resourceDetail: string; costCenter?: string; glCode?: string; }
Behavior notes
- A row counts as unassigned when costCenter is omitted, not based on a separate status field. That count is recalculated from the assignments array on every render and shown as a badge in the header.
- Unassigned rows get a light amber background tint so they stand out against assigned rows without needing a separate section.
- The GL code only renders when both costCenter and glCode are present; assigned rows without a glCode just show the cost center badge alone.
- There's no inline editing here, this is a read-only summary. Pair it with a select or dropdown in your own app to actually change an assignment.
Frequently asked questions
More Billing Blocks
View all →Billing Invoice List
Invoice history table with status badges, formatted amounts, and a per-row download link, built with shadcn/ui and Tailwind CSS.
Billing Failed Payment Alert
High-contrast failed-payment alert with a message, a retry button, and an optional update-payment-method button, built with shadcn/ui and Tailwind CSS.
Billing Credit Balance
Compact credit balance card with a large total, an optional purchased-versus-promotional breakdown, a low-balance notice, and a top-up button.
Billing Payment Methods
A saved payment method list for React and Next.js with brand icons, a default badge, near-expiry warnings, and remove/set-default actions per row.
Billing Add Card
A card entry form for React and Next.js with auto-formatted fields, internal brand detection, and per-field validation feedback built with shadcn/ui and Tailwind CSS.
Billing Coupon Code
An inline promo code input for React and Next.js with a simulated loading state, an applied summary showing the discount amount, and an invalid-code message.