- Accordion
- Agent Thinking
- Alert
- Alert Dialog
- Announcement
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Checkbox
- Checkbox Card
- Code Block
- Collapsible
- Color Picker
- Combobox
- Command
- Composer
- Composer Loader
- Context Menu
- Data Grid
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- File Upload
- Hover Card
- Input
- Input Group
- Input Otp
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Meter
- Native Select
- Navigation Menu
- Number Field
- Pagination
- Period Switcher
- Popover
- Progress
- Questionnaire
- Radio Card
- Radio Group
- Resizable
- Reveal
- Scroll Area
- Search Field
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Social Button
- Sonner
- Spinner
- Status Dot
- Switch
- Switch Card
- Table
- Tabs
- Tag Group
- Textarea
- Theme Toggle
- Time Field
- Toggle
- Toggle Group
- Tooltip
- Trace
- Tree View
- Agent Creator 01
- Agent Limits Card 01
- Agent Progress 01
- AI Chat 01
- AI Image Generation 01
- AI Profile 01
- Alerts Card 01
- Auth Card 01
- Calendar 01
- Composer 01
- Composer Attachments 01
- Composer Panel 01
- Finance Dashboard 01
- Home Dashboard 01
- Marketing Dashboard 01
- Medical Profile 01
- Meeting Scheduler 01
- Multi Agent Chat 01
- Notification Center 01
- Patient Info Card 01
- Project Board 01
- Questionnaire 01
- Settings Modal 01
- Sidebar 01
- Stat Cards 01
- Task List 01
- Web Search 01
- Activity Rings Card 01
- Area Chart Card 01
- Bar List Card 01
- Combo Chart Card 01
- Contributions Card 01
- Earnings Chart Card 01
- Funnel Chart Card 01
- Heatmap Chart Card 01
- Line Chart Card 01
- Most Active Days Card 01
- Orders Chart Card 01
- Radar Chart Card 01
- Radial Chart Card 01
- Revenue Chart Card 01
- Sankey Chart Card 01
- Scatter Chart Card 01
- Sleep Score Card 01
- Stage Bars Card 01
- Steps Card 01
| Project | Owner | Status |
|---|---|---|
| Orchard | Mina | Active |
| Field notes | Jules | Planning |
| Workshop | Ari | Complete |
| Project | Owner | Status |
|---|---|---|
| Orchard | Mina | Active |
| Field notes | Jules | Planning |
| Workshop | Ari | Complete |
Installation
$ pnpm dlx shadcn@latest add @cobalt/table
Options
size="sm"is the denser 13px text option.TableRow hoverable={false}turns off the hover highlight, for header and static rows.
Source
"use client";
import { cn } from "cn";
import * as React from "react";
function Table({
className,
size = "default",
...props
}: React.ComponentProps<"table"> & { size?: "default" | "sm" }) {
return (
<div
data-slot="table-container"
className="relative w-full overflow-x-auto"
>
<table
data-slot="table"
data-size={size}
className={cn(
"w-full border-collapse caption-bottom text-start text-sm [&_th]:transition-[padding,font-size] [&_th]:duration-200 [&_th]:ease-[ease] [&_td]:transition-[padding,font-size] [&_td]:duration-200 [&_td]:ease-[ease] motion-reduce:[&_th]:transition-none motion-reduce:[&_td]:transition-none data-[size=sm]:[&_th]:px-2.5 data-[size=sm]:[&_th]:py-1.5 data-[size=sm]:[&_th]:text-[13px] data-[size=sm]:[&_th]:leading-[18px] data-[size=sm]:[&_td]:px-2.5 data-[size=sm]:[&_td]:py-1.5 data-[size=sm]:[&_td]:text-[13px] data-[size=sm]:[&_td]:leading-[18px]",
className
)}
{...props}
/>
</div>
);
}
function TableHeader({ className, ...props }: React.ComponentProps<"thead">) {
return (
<thead data-slot="table-header" className={cn(className)} {...props} />
);
}
function TableBody({ className, ...props }: React.ComponentProps<"tbody">) {
return (
<tbody
data-slot="table-body"
className={cn(
"[&_tr:not(:last-child)]:border-b [&_tr:not(:last-child)]:border-[var(--border-subtle,var(--border))]",
className
)}
{...props}
/>
);
}
function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
return (
<tfoot
data-slot="table-footer"
className={cn(
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
className
)}
{...props}
/>
);
}
function TableRow({
className,
hoverable = true,
...props
}: React.ComponentProps<"tr"> & {
/** Set to false for header and static rows that should not highlight on hover. */
hoverable?: boolean;
}) {
return (
<tr
data-slot="table-row"
className={cn(
// Only hover fades; selecting or unselecting a row switches at once.
"transition-colors duration-150 motion-reduce:transition-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted data-[state=selected]:transition-none",
hoverable && "hover:bg-muted/50",
className
)}
{...props}
/>
);
}
function TableHead({ className, ...props }: React.ComponentProps<"th">) {
return (
<th
data-slot="table-head"
className={cn(
"border-y border-[var(--border-subtle,var(--border))] bg-[var(--surface-sunken,var(--muted))] px-3 py-2.5 text-start align-middle text-sm leading-5 font-medium whitespace-nowrap text-[color:var(--foreground-subtle,var(--muted-foreground))] outline-none [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
);
}
function TableCell({ className, ...props }: React.ComponentProps<"td">) {
return (
<td
data-slot="table-cell"
className={cn(
"px-3 py-2.5 align-middle text-sm leading-5 font-medium text-[color:var(--foreground-strong,var(--foreground))] outline-none [&:has([role=checkbox])]:pr-0",
className
)}
{...props}
/>
);
}
function TableCaption({
className,
...props
}: React.ComponentProps<"caption">) {
return (
<caption
data-slot="table-caption"
className={cn("mt-4 text-sm text-muted-foreground", className)}
{...props}
/>
);
}
export {
Table,
TableHeader,
TableBody,
TableFooter,
TableHead,
TableRow,
TableCell,
TableCaption,
}; On this page