--- components: ["DataTable", "Toolbar", "ToolbarContent", "ToolbarSearch", "ToolbarMenu", "ToolbarMenuItem", "ToolbarBatchActions"] --- ### Default ### Slotted cells Use the `"cell"` slot to control the display value per table cell. Individual row and cell data are provided through the `let:row` and `let:cell` directives. The slot name for the table header cells is `"cell-header"`. {#if header.key === 'port'} {header.value} (network) {:else} {header.value} {/if} {#if cell.key === 'rule' && cell.value === 'Round robin'} {cell.value} {:else} {cell.value} {/if} ### With title, description ### With custom display and sort methods cost + " €" }, { key: "expireDate", value: "Expire date", display: (date) => new Date(date).toLocaleString(), sort: (a, b) => (new Date(a) <= new Date(b) ? -1 : 1), }, ]}" rows="{[ { id: "a", name: "Load Balancer 3", protocol: "HTTP", port: 3000, cost: 100, expireDate: "2020-10-21", }, { id: "b", name: "Load Balancer 1", protocol: "HTTP", port: 443, cost: 200, expireDate: "2020-09-10", }, { id: "c", name: "Load Balancer 2", protocol: "HTTP", port: 80, cost: 150, expireDate: "2020-11-24", }, { id: "d", name: "Load Balancer 6", protocol: "HTTP", port: 3000, cost: 250, expireDate: "2020-12-01", }, { id: "e", name: "Load Balancer 4", protocol: "HTTP", port: 443, cost: 550, expireDate: "2021-03-21", }, { id: "f", name: "Load Balancer 5", protocol: "HTTP", port: 80, cost: 400, expireDate: "2020-11-14", }, ]}" /> ### With toolbar Restart all API documentation Stop all Create balancer ### With toolbar (small size) Restart all API documentation Stop all Create balancer ### Zebra stripes ### Tall rows ### Short rows ### Compact rows ### Sortable ### Empty column with overflow menu Some use cases require an empty column in the table body without a corresponding table header. For an object in the `headers` array, set `empty` to `true` to render an empty column. In the following example, each row in the sortable data table has an overflow menu. There isn't a separate, useless table header column for the overflow menu. ### Selectable ### Initial selected rows ### Selectable with batch actions ### Selectable (radio) ### Expandable {JSON.stringify(row, null, 2)} ### Batch expansion {JSON.stringify(row, null, 2)} ### Skeleton ### Skeleton with headers, row count ### Skeleton without header, toolbar ### Skeleton (tall size) ### Skeleton (short size) ### Skeleton (compact size)
{JSON.stringify(row, null, 2)}