{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "table",
  "type": "registry:ui",
  "title": "Table",
  "description": "Table is a native HTML table foundation with captions, headers, body rows, footers, cell alignment, responsive overflow, RTL support, print-friendly scrolling, and composition patterns for empty/loading/error — not the interactive Data Table pattern (no sorting, selection, or pagination).",
  "author": "Skrewww",
  "dependencies": [],
  "registryDependencies": [
    "@skrewww/foundation"
  ],
  "docs": "Host requirements (assumed already present, not installed by this command): react, react-dom.",
  "files": [
    {
      "path": "components/ui/Table.tsx",
      "content": "/** @skrewww-component table */\n\"use client\";\n\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from \"react\";\nimport { cn } from \"@/lib/cn\";\nimport styles from \"@/components/ui/table.module.css\";\n\nexport type TableAlign = \"start\" | \"center\" | \"end\";\n\nexport type TableProps = ComponentPropsWithoutRef<\"table\"> & {\n  /** Table layout algorithm. Defaults to browser auto layout. */\n  layout?: \"auto\" | \"fixed\";\n};\n\nexport type TableCaptionProps = ComponentPropsWithoutRef<\"caption\"> & {\n  /** Visible caption (default) or visually hidden while remaining accessible. */\n  visibility?: \"visible\" | \"screen-reader\";\n};\n\nexport type TableHeadProps = Omit<ComponentPropsWithoutRef<\"th\">, \"align\"> & {\n  align?: TableAlign;\n};\n\nexport type TableCellProps = Omit<ComponentPropsWithoutRef<\"td\">, \"align\"> & {\n  align?: TableAlign;\n};\n\nexport type TableScrollAreaProps = ComponentPropsWithoutRef<\"div\"> & {\n  /**\n   * Accessible name for the overflow region.\n   * When provided (or when aria-label / aria-labelledby is set), the wrapper uses role=\"region\".\n   * Prefer a label that describes scrolling/navigation value — do not duplicate the table caption verbatim.\n   *\n   * Focus policy: tabIndex remains consumer-controlled. Do not set tabIndex={0} on every table.\n   * For known horizontally scrollable application tables, set tabIndex={0} so keyboard users can\n   * focus the region and scroll with arrow keys / shift+scroll. Omit tabIndex when the table fits.\n   */\n  accessibleLabel?: string;\n};\n\nconst alignClass: Record<TableAlign, string> = {\n  start: styles.alignStart,\n  center: styles.alignCenter,\n  end: styles.alignEnd,\n};\n\nexport const Table = forwardRef<ElementRef<\"table\">, TableProps>(function Table(\n  { className, layout = \"auto\", ...props },\n  ref,\n) {\n  return (\n    <table\n      ref={ref}\n      data-layout={layout}\n      className={cn(styles.table, layout === \"fixed\" && styles.layoutFixed, className)}\n      {...props}\n    />\n  );\n});\n\nexport const TableCaption = forwardRef<ElementRef<\"caption\">, TableCaptionProps>(\n  function TableCaption({ className, visibility = \"visible\", ...props }, ref) {\n    return (\n      <caption\n        ref={ref}\n        data-visibility={visibility}\n        className={cn(\n          styles.caption,\n          visibility === \"screen-reader\" && styles.captionScreenReader,\n          className,\n        )}\n        {...props}\n      />\n    );\n  },\n);\n\nexport const TableHeader = forwardRef<\n  ElementRef<\"thead\">,\n  ComponentPropsWithoutRef<\"thead\">\n>(function TableHeader({ className, ...props }, ref) {\n  return <thead ref={ref} className={cn(styles.header, className)} {...props} />;\n});\n\nexport const TableBody = forwardRef<\n  ElementRef<\"tbody\">,\n  ComponentPropsWithoutRef<\"tbody\">\n>(function TableBody({ className, ...props }, ref) {\n  return <tbody ref={ref} className={cn(styles.body, className)} {...props} />;\n});\n\nexport const TableFooter = forwardRef<\n  ElementRef<\"tfoot\">,\n  ComponentPropsWithoutRef<\"tfoot\">\n>(function TableFooter({ className, ...props }, ref) {\n  return <tfoot ref={ref} className={cn(styles.footer, className)} {...props} />;\n});\n\nexport const TableRow = forwardRef<ElementRef<\"tr\">, ComponentPropsWithoutRef<\"tr\">>(\n  function TableRow({ className, ...props }, ref) {\n    return <tr ref={ref} className={cn(styles.row, className)} {...props} />;\n  },\n);\n\nexport const TableHead = forwardRef<ElementRef<\"th\">, TableHeadProps>(function TableHead(\n  { className, align = \"start\", ...props },\n  ref,\n) {\n  return (\n    <th\n      ref={ref}\n      data-align={align}\n      className={cn(styles.head, alignClass[align], className)}\n      {...props}\n    />\n  );\n});\n\nexport const TableCell = forwardRef<ElementRef<\"td\">, TableCellProps>(function TableCell(\n  { className, align = \"start\", ...props },\n  ref,\n) {\n  return (\n    <td\n      ref={ref}\n      data-align={align}\n      className={cn(styles.cell, alignClass[align], className)}\n      {...props}\n    />\n  );\n});\n\nexport const TableScrollArea = forwardRef<ElementRef<\"div\">, TableScrollAreaProps>(\n  function TableScrollArea(\n    { className, accessibleLabel, role, \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy, ...props },\n    ref,\n  ) {\n    const resolvedLabel = accessibleLabel ?? ariaLabel;\n    const hasAccessibleName = Boolean(resolvedLabel || ariaLabelledBy);\n    const regionRole = role ?? (hasAccessibleName ? \"region\" : undefined);\n\n    return (\n      <div\n        ref={ref}\n        role={regionRole}\n        aria-label={resolvedLabel}\n        aria-labelledby={ariaLabelledBy}\n        data-table-scroll=\"\"\n        className={cn(styles.scrollArea, className)}\n        {...props}\n      />\n    );\n  },\n);\n",
      "type": "registry:ui",
      "target": "~/components/ui/Table.tsx"
    },
    {
      "path": "components/ui/table.module.css",
      "content": "/* Canonical visual anatomy: Content/Table 2321:1964. React keeps native table semantics. */\n\n.scrollArea {\n  /* Figma locks the Table shell and rows to Surface=Flat. Rebind only the\n     shared contracts Table consumes so Gradient/Glass ancestors cannot make\n     the shell translucent or change its muted header content. */\n  --component-card-surface: var(--semantic-surface-default);\n  --component-card-border: var(--semantic-border-default);\n  --component-surface-content-muted: var(--semantic-icon-muted);\n  --component-surface-backdrop-filter: none;\n  --table-surface: var(--component-card-surface);\n  --table-border: var(--component-card-border);\n  --table-header-text: var(--semantic-text-secondary);\n\n  box-sizing: border-box;\n  /* Shrink correctly in flex/grid parents; own horizontal overflow locally. */\n  width: 100%;\n  max-width: 100%;\n  min-width: 0;\n  overflow-x: auto;\n  overflow-y: hidden;\n  border: 1px solid var(--table-border);\n  border-radius: var(--table-radius);\n  color: var(--table-text);\n  box-shadow: none;\n  backdrop-filter: var(--component-surface-backdrop-filter);\n  -webkit-overflow-scrolling: touch;\n  /* Edge fades reveal more columns without claiming columns are hidden. */\n  background-color: var(--table-surface);\n  background-image:\n    linear-gradient(to right, var(--table-surface), transparent),\n    linear-gradient(to left, var(--table-surface), transparent),\n    linear-gradient(to right, var(--table-scroll-shadow), transparent),\n    linear-gradient(to left, var(--table-scroll-shadow), transparent);\n  background-position:\n    0 0,\n    100% 0,\n    0 0,\n    100% 0;\n  background-repeat: no-repeat;\n  background-size:\n    var(--table-scroll-fade-size) 100%,\n    var(--table-scroll-fade-size) 100%,\n    calc(var(--table-scroll-fade-size) * 0.7) 100%,\n    calc(var(--table-scroll-fade-size) * 0.7) 100%;\n  background-attachment: local, local, scroll, scroll;\n}\n\n.scrollArea:focus {\n  outline: none;\n}\n\n.scrollArea:focus-visible {\n  outline: 2px solid var(--semantic-focus-ring);\n  outline-offset: 2px;\n}\n\n.table {\n  width: 100%;\n  border-collapse: collapse;\n  border-spacing: 0;\n  background: transparent;\n  color: var(--table-text);\n  font-size: 0.875rem;\n  line-height: 1.2;\n  text-align: start;\n}\n\n/* Wide tables opt into overflow via TableScrollArea — do not force page-level scroll. */\n.scrollArea .table {\n  min-width: 36rem;\n}\n\n.layoutFixed {\n  table-layout: fixed;\n}\n\n.caption {\n  caption-side: top;\n  padding-block: var(--table-caption-gap);\n  padding-inline: var(--table-cell-padding-inline);\n  color: var(--table-caption-text);\n  font-size: 0.8125rem;\n  font-weight: 500;\n  text-align: start;\n}\n\n.captionScreenReader {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  padding: 0;\n  margin: -1px;\n  overflow: hidden;\n  clip: rect(0, 0, 0, 0);\n  clip-path: inset(50%);\n  white-space: nowrap;\n  border: 0;\n}\n\n.header {\n  background: var(--table-header-surface);\n}\n\n.body {\n  background: var(--table-body-surface);\n}\n\n.head {\n  padding-block: var(--table-cell-padding-block);\n  padding-inline: var(--table-cell-padding-inline);\n  border-bottom: 1px solid var(--table-header-border);\n  color: var(--table-header-text);\n  font-weight: 700;\n  text-align: start;\n  vertical-align: middle;\n  overflow-wrap: anywhere;\n}\n\n.body .row:not(:last-child) .cell,\n.body .row:not(:last-child) .head {\n  border-bottom: 1px solid var(--table-row-border);\n}\n\n.cell {\n  padding-block: var(--table-cell-padding-block);\n  padding-inline: var(--table-cell-padding-inline);\n  color: var(--table-text);\n  font-weight: 400;\n  text-align: start;\n  vertical-align: middle;\n  overflow-wrap: anywhere;\n}\n\n.body .head {\n  color: var(--table-text);\n  font-weight: 400;\n}\n\n.cell[data-table-wrap=\"nowrap\"],\n.head[data-table-wrap=\"nowrap\"] {\n  white-space: nowrap;\n  overflow-wrap: normal;\n}\n\n.footer {\n  background: var(--table-footer-surface);\n}\n\n.footer .cell,\n.footer .head {\n  border-top: 1px solid var(--table-header-border);\n  font-weight: 600;\n}\n\n.footer .head {\n  color: var(--table-text);\n}\n\n.row {\n  background: transparent;\n}\n\n.alignStart {\n  text-align: start;\n}\n\n.alignCenter {\n  text-align: center;\n}\n\n.alignEnd {\n  text-align: end;\n  font-variant-numeric: tabular-nums;\n}\n\n@media print {\n  .scrollArea {\n    overflow: visible;\n    width: auto;\n    min-width: 0;\n    max-width: none;\n    border-radius: 0;\n    background-image: none;\n    box-shadow: none;\n  }\n\n  .scrollArea .table {\n    min-width: 0;\n  }\n}\n",
      "type": "registry:ui",
      "target": "~/components/ui/table.module.css"
    },
    {
      "path": "lib/cn.ts",
      "content": "export function cn(...classes: Array<string | false | null | undefined>): string {\n  return classes.filter(Boolean).join(\" \");\n}\n",
      "type": "registry:lib",
      "target": "~/lib/cn.ts"
    }
  ]
}
