Data Table TH
A data table col is a column header cell in a DataTable. It renders a <th scope="col"> element and is intended to live inside a DataTableRow within DataTableHead.
A data table col is a column header cell in a DataTable. It renders a <th scope="col"> element and is intended to live inside a DataTableRow within DataTableHead.
<th class="data-table-th">Column heading</th><script lang="ts">
import DataTable from "../DataTable/DataTable.svelte";
import DataTableHead from "../DataTableHead/DataTableHead.svelte";
import DataTableBody from "../DataTableBody/DataTableBody.svelte";
import DataTableRow from "../DataTableRow/DataTableRow.svelte";
import DataTableTD from "./DataTableTD.svelte";
import DataTableTD from "../DataTableTD/DataTableTD.svelte";
</script>
<DataTable label="Users">
<DataTableHead>
<DataTableRow>
<DataTableTD>Name</DataTableTD>
<DataTableTD>Email</DataTableTD>
<DataTableTD>Role</DataTableTD>
</DataTableRow>
</DataTableHead>
<DataTableBody>
<DataTableRow>
<DataTableTD>Alice</DataTableTD>
<DataTableTD>alice@example.com</DataTableTD>
<DataTableTD>Admin</DataTableTD>
</DataTableRow>
</DataTableBody>
</DataTable>
// In your Svelte component:
import DataTableTH from "lily-design-system-svelte-headless/components/DataTableTH/DataTableTH.svelte";
<DataTableTH>
<!-- DataTableTH content -->
</DataTableTH>
<DataTable label="Team roster">
<DataTableHead>
<DataTableRow>
<DataTableTD>Name</DataTableTD>
<DataTableTD>Role</DataTableTD>
<DataTableTD>Status</DataTableTD>
</DataTableRow>
</DataTableHead>
<DataTableBody>...</DataTableBody>
</DataTable>
colspan: number (optional) -- number of columns this header cell spansrowspan: number (optional) -- number of rows this header cell spansscope: "col" | "row" | "colgroup" | "rowgroup" (default: "col") -- header scopechildren: optional -- header cell content...restProps: any additional HTML attributes passed to the <th> elementNone -- this component is a header cell and is not interactive.
scope="col" associates the header with its column for assistive technologiesscope="colgroup" together with colspan for grouped column headerscolspan / rowspan<colgroup> / <col> -- write those directly inside DataTableThis headless DataTableTD component provides a <th> element. The consumer provides all visual styling.
The consumer provides all CSS styling. The component renders with a .data-table-th class for targeting. No default styles are included — this is a fully headless component.
<th> element with class data-table-thscope="col" is the defaultcolspan / rowspan are applied when set<th> element with scope="col" by defaultcolspan / rowspan for grouped header cellsscope (e.g. "colgroup" for grouped headers)restProps onto the <th> elementDataTableTD is part of the DataTable composition pattern: DataTable > DataTableHead > DataTableRow > DataTableTD.
data-table — a data table interactive grid for displaying and sorting tabular data <table>data-table-body — a data table interactive grid tbody for displaying and sorting tabular data <tbody>data-table-foot — a data table interactive grid tfoot for displaying and sorting tabular data <tfoot>data-table-head — a data table interactive grid thead for displaying and sorting tabular data <thead>data-table-row — a data table interactive grid row for displaying and sorting tabular data <tr>data-table-td — a data table interactive grid data cell for displaying and sorting tabular data <td>table — a table with rows and columns <table>Generated from this component's canonical metadata — the machine-checked source the implementations are held to.
scope="col" associates the header with its column for assistive technologiesscope="colgroup" together with colspan for grouped column headerscolspan: number (optional) -- number of columns this header cell spansrowspan: number (optional) -- number of rows this header cell spansscope: "col" | "row" | "colgroup" | "rowgroup" (default: "col") -- header scopechildren: optional -- header cell content...restProps: Any additional HTML attributes passed to the <th> element