Table
octane/tableFreeComponent
octane publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by octane on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://raw.githubusercontent.com/octanejs/octane/main/packages/shadcn/registry/table.jsonSource
1// Base UI base table — THIS FAMILY IS BASE-INDEPENDENT. Neither Radix nor Base UI publishes a2// table primitive, so upstream ships the same plain host elements in both bases and this file is3// the radix base's content unchanged. (The React Aria base is the odd one out: RAC does have a4// table, so that base runs on real collection components with generic item types.)5//6// There is consequently no dialect to get wrong here and nothing to verify against a primitive:7// `data-[state=selected]` on the row is written by the CONSUMER — a data-table library setting8// selection state — not emitted by anything underneath, so unlike checkbox or toggle it is not a9// Radix-ism that needs translating.10import { cn } from '@/lib/utils';1112// Multi-host family (div/table/thead/tbody/tr/th/td/caption): no single host13// prop table applies, so the shared alias stays structural.14type Props = { className?: string } & Record<string, unknown>;1516export function Table({ className, ...props }: Props) @{17 <div data-slot="table-container" className="relative w-full overflow-x-auto">18 <table19 data-slot="table"20 className={cn('w-full caption-bottom text-sm', className)}21 {...props}22 />23 </div>24}2526export function TableHeader({ className, ...props }: Props) @{27 <thead data-slot="table-header" className={cn('[&_tr]:border-b', className)} {...props} />28}2930export function TableBody({ className, ...props }: Props) @{31 <tbody32 data-slot="table-body"33 className={cn('[&_tr:last-child]:border-0', className)}34 {...props}35 />36}3738export function TableFooter({ className, ...props }: Props) @{39 <tfoot40 data-slot="table-footer"41 className={cn('bg-muted/50 border-t font-medium [&>tr]:last:border-b-0', className)}42 {...props}43 />44}4546export function TableRow({ className, ...props }: Props) @{47 <tr48 data-slot="table-row"49 className={cn(50 'border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted',51 className,52 )}53 {...props}54 />55}5657export function TableHead({ className, ...props }: Props) @{58 <th59 data-slot="table-head"60 className={cn(61 'text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',62 className,63 )}64 {...props}65 />66}6768export function TableCell({ className, ...props }: Props) @{69 <td70 data-slot="table-cell"71 className={cn(72// … truncated
What it pulls in
Other registry items
Files it writes
More from octane
All 44 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | octane | Components | Free | 2 deps | |
| Alertalert | octane | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | octane | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | octane | Components | Free | no deps | |
| Avataravatar | octane | Components | Free | 1 dep | |
| Badgebadge | octane | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | octane | Components | Free | 1 dep | |
| Buttonbutton | octane | Components | Free | 2 deps |
