{
  "$schema": "https://design.senvenli.com/schema/component.full.json",
  "kind": "component",
  "family": "collection",
  "status": "alpha",
  "import": "@senvenli/react/collection",
  "name": "table",
  "title": "Table",
  "exports": [
    "Table"
  ],
  "description": "Records people scan, compare, sort and act on: sortable columns, row selection by checkbox, a row that opens its record.",
  "keywords": [
    "table",
    "grid",
    "rows",
    "columns",
    "sort",
    "records"
  ],
  "usage": {
    "when": [
      "Records with several comparable fields on screens 640px and wider."
    ],
    "instead": [
      {
        "use": "data-table",
        "when": "The table also needs search, filters, paging or a column picker."
      },
      {
        "use": "grid-list",
        "when": "The screen is narrow or each record is one line of text."
      }
    ]
  },
  "a11y": {
    "keyboard": [
      {
        "keys": "Arrow keys",
        "does": "Move between cells and rows."
      },
      {
        "keys": "Space",
        "does": "Selects the focused row."
      },
      {
        "keys": "Enter",
        "does": "Opens the focused row's record."
      }
    ],
    "builtIn": [
      "The row header column names each row for screen readers.",
      "Sort state is announced on the column header."
    ],
    "youProvide": [
      "An aria-label for the table."
    ]
  },
  "related": [
    "data-table",
    "grid-list"
  ],
  "genui": {
    "expose": true,
    "description": "Rows of records under named columns. Keep it under 8 columns; one column is the row header.",
    "props": [
      "aria-label",
      "columns",
      "rows",
      "density"
    ],
    "children": "none",
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "aria-label": {
          "type": "string",
          "description": "Names the table (\"Orders\")."
        },
        "columns": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "key": {
                "type": "string"
              },
              "header": {
                "type": "string"
              },
              "align": {
                "type": "string",
                "enum": [
                  "start",
                  "end"
                ]
              },
              "isSortable": {
                "type": "boolean"
              },
              "width": {
                "type": "string"
              },
              "wrap": {
                "type": "boolean"
              },
              "isRowHeader": {
                "type": "boolean"
              },
              "hideBelow": {
                "type": "string",
                "enum": [
                  "sm",
                  "md",
                  "lg",
                  "xl"
                ]
              }
            },
            "required": [
              "key",
              "header"
            ]
          }
        },
        "rows": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          }
        },
        "density": {
          "type": "string",
          "enum": [
            "comfortable",
            "compact"
          ],
          "description": "`compact` (36px rows) for dense working screens; `default` (48px) for public and content pages."
        }
      },
      "required": [
        "aria-label",
        "columns",
        "rows"
      ]
    }
  },
  "source": [
    "src/collection/table.tsx"
  ],
  "props": {
    "Table": [
      {
        "name": "aria-label",
        "type": "string",
        "required": true,
        "origin": "own",
        "description": "Names the table (\"Orders\").",
        "schema": {
          "type": "string"
        }
      },
      {
        "name": "columns",
        "type": "readonly TableColumn<T>[]",
        "required": true,
        "origin": "own",
        "schema": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "key": {
                "type": "string"
              },
              "header": {
                "type": "string"
              },
              "align": {
                "type": "string",
                "enum": [
                  "start",
                  "end"
                ]
              },
              "isSortable": {
                "type": "boolean"
              },
              "width": {
                "type": "string"
              },
              "wrap": {
                "type": "boolean"
              },
              "isRowHeader": {
                "type": "boolean"
              },
              "hideBelow": {
                "type": "string",
                "enum": [
                  "sm",
                  "md",
                  "lg",
                  "xl"
                ]
              }
            },
            "required": [
              "key",
              "header"
            ]
          }
        }
      },
      {
        "name": "rows",
        "type": "readonly T[]",
        "required": true,
        "origin": "own",
        "schema": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "number",
                "boolean",
                "null"
              ]
            }
          }
        }
      },
      {
        "name": "rowKey",
        "type": "(row: T) => Key",
        "required": false,
        "origin": "own",
        "description": "The row's stable id; `row.id` by default. Ids must be unique within the table. When the data has no\nsingle unique field, build one from the fields that are (`${row.date}:${row.channel}`), or add the row's\nindex as a last resort. A repeated id still renders every row: the first keeps its id and the later ones\nare keyed `a#2`, `a#3`, … in row order, and selection and `onRowAction` receive those suffixed keys; a\ndevelopment warning names the repeated ids. A suffixed key follows the row's position, not\nthe row: after a sort or filter, a selection made through it can move to another copy of the id."
      },
      {
        "name": "selectionMode",
        "type": "\"none\" | \"single\" | \"multiple\"",
        "required": false,
        "origin": "own",
        "schema": {
          "type": "string",
          "enum": [
            "none",
            "single",
            "multiple"
          ]
        }
      },
      {
        "name": "selectedKeys",
        "type": "\"all\" | Iterable<Key>",
        "required": false,
        "origin": "own"
      },
      {
        "name": "defaultSelectedKeys",
        "type": "\"all\" | Iterable<Key>",
        "required": false,
        "origin": "own"
      },
      {
        "name": "onSelectionChange",
        "type": "(keys: Selection) => void",
        "required": false,
        "origin": "own"
      },
      {
        "name": "sortDescriptor",
        "type": "SortDescriptor",
        "required": false,
        "origin": "own"
      },
      {
        "name": "onSortChange",
        "type": "(descriptor: SortDescriptor) => void",
        "required": false,
        "origin": "own"
      },
      {
        "name": "density",
        "type": "Density",
        "required": false,
        "origin": "own",
        "description": "`compact` (36px rows) for dense working screens; `default` (48px) for public and content pages.",
        "schema": {
          "type": "string",
          "enum": [
            "comfortable",
            "compact"
          ]
        }
      },
      {
        "name": "emptyState",
        "type": "React.ReactNode",
        "required": false,
        "origin": "own",
        "description": "Shown when there are no rows: an `EmptyState`, or one sentence on why it is empty and the action that fills it."
      },
      {
        "name": "onRowAction",
        "type": "(key: Key) => void",
        "required": false,
        "origin": "own",
        "description": "Opens the record: the whole row is the target."
      },
      {
        "name": "maxHeight",
        "type": "string",
        "required": false,
        "origin": "own",
        "description": "A height for the scroll area: the header stays put and gets a shadow once rows scroll under it.",
        "schema": {
          "type": "string"
        }
      }
    ]
  },
  "tokens": [
    "ds-background-selected",
    "ds-border",
    "ds-border-focused",
    "ds-border-selected",
    "ds-radius-large",
    "ds-radius-medium",
    "ds-shadow-overflow",
    "ds-shadow-overlay",
    "ds-shadow-raised",
    "ds-size-row",
    "ds-size-row-compact",
    "ds-space-050",
    "ds-space-150",
    "ds-space-200",
    "ds-space-300",
    "ds-space-500",
    "ds-surface-hovered",
    "ds-surface-overlay",
    "ds-surface-raised",
    "ds-surface-sunken",
    "ds-text",
    "ds-text-subtle",
    "ds-text-subtlest"
  ],
  "strings": [
    "selection"
  ],
  "quality": {
    "tests": true,
    "a11y": false,
    "docs": false,
    "visual": false,
    "dark": false,
    "rtl": false,
    "mcp": true,
    "generic": true
  }
}
