{
  "_copyright": "Copyright (c) 2026, Salesforce, Inc., All rights reserved. For full license text, see the LICENSE.txt file",
  "$schema": "https://slds.lightningdesignsystem.com/schemas/uif-foundation.v1.json",
  "apiVersion": "1.0.0",
  "name": "DataTable",
  "description": "Initializes data table",
  "structure": {
    "name": "root",
    "restrict": [
      "table",
      "div"
    ],
    "description": "Initializes data table",
    "attributes": {
      "static": {
        "role": "grid"
      }
    },
    "children": [
      {
        "name": "caption",
        "restrict": [
          "caption",
          "h2",
          "h3"
        ],
        "description": "Optional visible heading associated with the table via aria-labelledby",
        "renderWhen": "slotFilled",
        "slot": {
          "name": "caption"
        }
      },
      {
        "name": "thead",
        "restrict": [
          "thead"
        ],
        "description": "Table header section",
        "children": [
          {
            "name": "headerRow",
            "restrict": [
              "tr"
            ],
            "description": "Header row containing the column header cells",
            "children": [
              {
                "name": "headerCell",
                "restrict": [
                  "th"
                ],
                "description": "A single column header cell. Repeats once per column.",
                "repeats": true,
                "slot": {
                  "name": "headerCells",
                  "required": true
                },
                "children": [
                  {
                    "name": "headerCellLabel",
                    "restrict": [
                      "div",
                      "span"
                    ],
                    "description": "Visible (or assistive-text only) column label wrapper"
                  },
                  {
                    "name": "headerCellAction",
                    "restrict": [
                      "a"
                    ],
                    "description": "Interactive action region for a sortable column header"
                  },
                  {
                    "name": "headerCellSortIcon",
                    "restrict": [
                      "span",
                      "svg"
                    ],
                    "description": "Sort direction icon shown on sortable columns"
                  },
                  {
                    "name": "headerCellMenuButton",
                    "restrict": [
                      "button"
                    ],
                    "description": "Optional column-actions menu trigger rendered next to the sortable label"
                  },
                  {
                    "name": "headerCellResizer",
                    "restrict": [
                      "div"
                    ],
                    "description": "Resize handle for columns whose width is user-adjustable"
                  },
                  {
                    "name": "headerCellSelectAll",
                    "restrict": [
                      "div"
                    ],
                    "description": "Select-all checkbox affordance in the leading selection column"
                  }
                ]
              }
            ]
          }
        ]
      },
      {
        "name": "tbody",
        "restrict": [
          "tbody"
        ],
        "description": "Table body section",
        "slot": {
          "name": "default"
        },
        "children": [
          {
            "name": "row",
            "restrict": [
              "tr"
            ],
            "description": "A single data row. Repeats once per record.",
            "repeats": true,
            "children": [
              {
                "name": "rowHeader",
                "restrict": [
                  "th"
                ],
                "description": "Row header cell (typically the primary identifier column)"
              },
              {
                "name": "cell",
                "restrict": [
                  "td"
                ],
                "description": "Data cell. Repeats per column.",
                "repeats": true,
                "children": [
                  {
                    "name": "cellContent",
                    "restrict": [
                      "div",
                      "span"
                    ],
                    "description": "Wrapper around the cell value that supplies truncation, alignment, and edit affordances"
                  },
                  {
                    "name": "cellEditButton",
                    "restrict": [
                      "button"
                    ],
                    "description": "Inline-edit trigger rendered in editable cells"
                  },
                  {
                    "name": "cellErrorIndicator",
                    "restrict": [
                      "button"
                    ],
                    "description": "Error indicator button rendered in the leading errors column when a row has validation errors"
                  },
                  {
                    "name": "cellEditPopover",
                    "restrict": [
                      "section"
                    ],
                    "description": "Edit popover surfaced when a cell enters edit mode"
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "states": [
    {
      "name": "sortedBy",
      "type": "boolean",
      "description": "Whether a column is currently the active sort column"
    },
    {
      "name": "sortDirection",
      "type": "enum",
      "aria": "aria-sort",
      "options": [
        "ascending",
        "descending",
        "none"
      ],
      "description": "Sort direction of the active sorted column"
    },
    {
      "name": "selectedRows",
      "type": "boolean",
      "aria": "aria-selected",
      "description": "Whether one or more rows in the table are selected"
    },
    {
      "name": "hasError",
      "type": "boolean",
      "description": "Whether one or more rows or cells are in an error state"
    },
    {
      "name": "edited",
      "type": "boolean",
      "description": "Whether one or more cells have unsaved edits"
    },
    {
      "name": "focused",
      "type": "boolean",
      "description": "Whether a cell currently has keyboard focus"
    },
    {
      "name": "editing",
      "type": "boolean",
      "description": "Whether a cell is currently in inline-edit mode"
    },
    {
      "name": "resizing",
      "type": "boolean",
      "description": "Whether a column is currently being resized"
    },
    {
      "name": "actionable",
      "type": "boolean",
      "description": "Whether the table is in actionable mode (cells focusable via keyboard navigation)"
    }
  ],
  "accessibility": {
    "requirements": [
      {
        "id": "grid-role",
        "description": "Interactive tables (with selection, sorting, inline edit, or actionable mode) should expose role='grid'"
      },
      {
        "id": "table-label",
        "description": "The table must have an accessible name via aria-label or aria-labelledby"
      },
      {
        "id": "aria-sort",
        "description": "Sortable column headers should declare aria-sort and update it to 'ascending' or 'descending' when active"
      },
      {
        "id": "aria-multiselectable",
        "description": "Tables that allow multi-row selection should set aria-multiselectable='true' on the grid"
      },
      {
        "id": "row-selection",
        "description": "Selected rows should expose aria-selected='true'"
      },
      {
        "id": "select-all-label",
        "description": "The select-all column header needs an assistive-text label and an associated checkbox label"
      },
      {
        "id": "row-action-popup",
        "description": "Row-level menu triggers should expose aria-haspopup='true'"
      },
      {
        "id": "decorative-icons",
        "description": "Sort, edit, lock, and chevron icons that have a paired visible or assistive label should set aria-hidden='true'"
      },
      {
        "id": "edit-popover-dialog",
        "description": "Inline-edit popovers should expose role='dialog' and be associated with their content via aria-describedby"
      },
      {
        "id": "sort-announcement",
        "description": "When sort direction changes, an aria-live region (polite, atomic) should announce the new direction"
      }
    ]
  }
}
