Tabs
Svelte ComponentUse tabs to quickly switch between different views.
Import
Package
Source
Docs
WAI-ARIA
Examples
Examples
Content A
Content A
Books
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Usage
import { writable, type Writable } from 'svelte/store';
const storeTab: Writable<string> = writable('a');
<TabGroup selected={storeTab}>
<Tab value="a">(labelA)</Tab>
<Tab value="b">(labelB)</Tab>
</TabGroup>
<!-- Conditionally display content -->
{#if $storeTab === 'a'}Content A{/if}
{#if $storeTab === 'b'}Content B{/if}