{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"table","title":"Table","author":"brijr","description":"A set of styled table primitives.","dependencies":["cn"],"files":[{"path":"components/ui/table.tsx","content":"import { renderElement, type PartProps } from \"@ui-sdk/react/primitive\"\nimport { cn } from \"cn\"\n\nfunction Table({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"table\">, \"className\"> & { className?: string }) {\n  return (\n    <div\n      data-slot=\"table-container\"\n      className=\"relative w-full overflow-x-auto\"\n    >\n      {renderElement(\n        \"table\",\n        {\n          \"data-slot\": \"table\",\n          className: cn(\"w-full caption-bottom text-sm\", className),\n          ...props,\n        },\n        render\n      )}\n    </div>\n  )\n}\n\nfunction TableHeader({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"thead\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"thead\",\n    {\n      \"data-slot\": \"table-header\",\n      className: cn(\"[&_tr]:border-b\", className),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction TableBody({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"tbody\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"tbody\",\n    {\n      \"data-slot\": \"table-body\",\n      className: cn(\"[&_tr:last-child]:border-0\", className),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction TableFooter({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"tfoot\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"tfoot\",\n    {\n      \"data-slot\": \"table-footer\",\n      className: cn(\n        \"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0\",\n        className\n      ),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction TableRow({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"tr\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"tr\",\n    {\n      \"data-slot\": \"table-row\",\n      className: cn(\n        \"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted\",\n        className\n      ),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction TableHead({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"th\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"th\",\n    {\n      \"data-slot\": \"table-head\",\n      className: cn(\n        \"h-10 px-2.5 text-left align-middle font-medium whitespace-nowrap text-muted-foreground [&:has([role=checkbox])]:pr-0\",\n        className\n      ),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction TableCell({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"td\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"td\",\n    {\n      \"data-slot\": \"table-cell\",\n      className: cn(\n        \"p-2.5 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\n        className\n      ),\n      ...props,\n    },\n    render\n  )\n}\n\nfunction TableCaption({\n  className,\n  render,\n  ...props\n}: Omit<PartProps<\"caption\">, \"className\"> & { className?: string }) {\n  return renderElement(\n    \"caption\",\n    {\n      \"data-slot\": \"table-caption\",\n      className: cn(\"mt-4 text-sm text-muted-foreground\", className),\n      ...props,\n    },\n    render\n  )\n}\n\nexport {\n  Table,\n  TableHeader,\n  TableBody,\n  TableFooter,\n  TableHead,\n  TableRow,\n  TableCell,\n  TableCaption,\n}\n","type":"registry:ui"}],"type":"registry:ui"}