Invoice
One invoice as a document on a raised page: who bills whom, the lines and totals, how it was paid, and downloading or sending it.
Inset · Sidebar. <AppShell direction="inset">, the default: the navigation on the grey app frame, the page a raised white card inside it, scrolling within.
npx wideset add block-invoice
Import the default export from @/blocks/wideset/invoice. The files below are relative to your project's source directory.
Installed with this block
app-shellavatarblock-stylesbreadcrumbsbuttoncarddividerdropdown-menuicon-buttonlist-itemsidebarstatus-badgetabletext-inpututils
blocks/wideset/invoice/index.tsx
'use client';
import '@/styles/wideset-blocks.css';
import { RiSideBarLine } from '@remixicon/react';
import { AppShell } from '@/components/ui/wideset/app-shell/AppShell';
import { Breadcrumbs } from '@/components/ui/wideset/breadcrumbs/Breadcrumbs';
import { cn } from '@/lib/wideset/utils';
import { IconButton } from '@/components/ui/wideset/button/IconButton';
import { useId, useState } from 'react';
import { ActivityTimeline } from './activity-timeline';
import { activity, invoice } from './data';
import { InvoiceDocument } from './invoice-document';
import { InvoiceHeader } from './invoice-header';
import { InvoiceSidebar } from './sidebar';
/** One column of the page: the header and the body share its edges. */
const COLUMN = 'px-ws-14 mx-auto w-full max-w-[80rem]';
/**
* Invoice (Inset direction): one invoice as a document on the raised page beside the workspace
* sidebar. The header names it and holds what to do with it; the document is the page's one
* object, its activity a narrow column beside it.
*/
export default function Invoice() {
const activityId = useId();
const sidebarId = useId();
const [collapsed, setCollapsed] = useState(false);
return (
<AppShell className="ws-block-utility" direction="inset">
<InvoiceSidebar id={sidebarId} collapsed={collapsed} onCollapsedChange={setCollapsed} />
<AppShell.Main>
<div className="h-ws-18 border-ws-static-base flex shrink-0 items-center border-b">
{/* The bar belongs to the surround: it runs edge to edge. The sidebar's toggle is pulled
left so its glyph, not its box, sits 20px from the edge; the crumbs follow it. */}
<div className="gap-ws-5 px-ws-11 flex w-full items-center">
<IconButton
icon={RiSideBarLine}
variant="secondary"
preset="ghost"
size="sm"
iconClassName="text-ws-static-subtle size-ws-9"
aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}
aria-expanded={!collapsed}
aria-controls={sidebarId}
onClick={() => setCollapsed((collapsed) => !collapsed)}
className="-ml-ws-5"
/>
<Breadcrumbs separator="arrow">
<Breadcrumbs.Item asChild>
<a href="#settings">Settings</a>
</Breadcrumbs.Item>
<Breadcrumbs.Item asChild>
<a href="#billing">Billing</a>
</Breadcrumbs.Item>
<Breadcrumbs.Item>{invoice.number}</Breadcrumbs.Item>
</Breadcrumbs>
</div>
</div>
{/* The page scrolls inside the card, so the card's corners stay put. */}
<div className="ws-scrollbar min-h-0 flex-1 overflow-y-auto">
<div className={cn(COLUMN, 'gap-ws-12 pt-ws-14 pb-ws-16 flex flex-col')}>
<InvoiceHeader />
<div className="gap-ws-16 grid grid-cols-1 items-start lg:grid-cols-[minmax(0,1fr)_18rem]">
<InvoiceDocument />
<aside aria-labelledby={activityId} className="gap-ws-9 flex flex-col">
<h2 id={activityId} className="typography-label-strong-md text-ws-static-strong">
Activity
</h2>
<ActivityTimeline items={activity} />
</aside>
</div>
</div>
</div>
</AppShell.Main>
</AppShell>
);
}