Table
uiable/tableFreeComponent
Table component.
Live preview
live · rendered by the registry
Rendered by uiable on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://uiable.com/r/table.jsonSource
1"use client";23import { ComponentProps } from "react";45import { cn } from "@/lib/utils";67function Table({ className, ...props }: ComponentProps<"table">) {8 return (9 <div10 data-slot="table-container"11 className="relative w-full overflow-x-auto"12 >13 <table14 data-slot="table"15 className={cn("w-full caption-bottom text-base", className)}16 {...props}17 />18 </div>19 );20}2122function TableHeader({ className, ...props }: ComponentProps<"thead">) {23 return (24 <thead25 data-slot="table-header"26 className={cn(27 "[&_tr]:border-b [&_tr]:border-b-border-border bg-background font-bold text-[13px] align-middle uppercase ltr:text-left! rtl:text-right! ",28 className29 )}30 {...props}31 />32 );33}3435function TableBody({ className, ...props }: ComponentProps<"tbody">) {36 return (37 <tbody38 data-slot="table-body"39 className={cn("[&_tr:last-child]:border-0", className)}40 {...props}41 />42 );43}4445function TableFooter({ className, ...props }: ComponentProps<"tfoot">) {46 return (47 <tfoot48 data-slot="table-footer"49 className={cn(50 "bg-background font-semibold border-t border-t-border-border [&>tr]:last:border-b-0",51 className52 )}53 {...props}54 />55 );56}5758function TableRow({ className, ...props }: ComponentProps<"tr">) {59 return (60 <tr61 data-slot="table-row"62 className={cn(63 "hover:bg-background data-[state=selected]:bg-background border-b border-b-border-border transition-colors",64 className65 )}66 {...props}67 />68 );69}7071function TableHead({ className, ...props }: ComponentProps<"th">) {72 return (73 <th74 data-slot="table-head"75 className={cn(76 "text-foreground p-[.9rem_.75rem] whitespace-nowrap [&:has([role=checkbox])]:pr-0 ltr:first:pl-5 ltr:first:sm:pl-[25px] ltr:last:pr-5 ltr:last:sm:pr-[25px] rtl:first:pr-5 rtl:first:sm:pr-[25px] rtl:last:pl-5 rtl:last:sm:pl-[25px]",77 className78 )}79 {...props}80 />81 );82}8384function TableCell({ className, ...props }: ComponentProps<"td">) {85 return (86 <td87 data-slot="table-cell"88 className={cn(89// … truncated
Files it writes
More from uiable
All 730 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | uiable | Components | Free | 2 deps | |
| Alertalert | uiable | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | uiable | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | uiable | Components | Free | no deps | |
| Attachmentattachment | uiable | Components | Free | 2 deps | |
| Avataravatar | uiable | Components | Free | 1 dep | |
| Badgebadge | uiable | Components | Free | 2 deps | |
| Breadcrumbbreadcrumb | uiable | Components | Free | 2 deps |
