Tabs
A row of tabs and the panel of the one that is selected. The selection is value (bind it to read or set it). Arrow keys move between the tabs, Home and End jump to the ends, and a tab is selected as soon as it is focused. Only the selected panel is rendered.
Slots are snippets: panel is given the selected tab and renders its content; end sits at the far end of the row (a count, an action).
| Type | Name | Description |
|---|---|---|
| { id: string, label: string, icon?: string, disabled?: boolean | []} |
tabs |
| string | value? |
The id of the selected tab (bindable). Defaults to the first enabled tab. |
| string | label? |
What the row of tabs is for, said to screen readers. |
| string | class? |
|
| import(‘svelte’).Snippet<[{ id: string, label: string | ]>} |
[panel] |
| import(‘svelte’).Snippet | end? |
<Tabs tabs={[{ id: "today", label: "Today" }, { id: "history", label: "History" }]} bind:value label="Period">
{#snippet panel(tab)}
{#if tab.id === "today"}<Today />{:else}<History />{/if}
{/snippet}
</Tabs>