Tabs
Organize content to sections.
Basic Example
<script>
import { Tabs, TabsButton, TabsContent, TabsList } from 'lithesome';
</script>
<Tabs>
<TabsList>
<TabButton value="tab-1">Tab 1</TabButton>
<TabButton value="tab-2">Tab 2</TabButton>
</TabsList>
<TabsContent value="tab-1">Tab 1 content</TabsContent>
<TabsContent value="tab-2">Tab 2 content</TabsContent>
</Tabs>
API Reference
<Tabs />
| Property | Type | Description |
|---|---|---|
value | string | The current value. |
orientation | Orientation | The direction of the tabs. |
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
activeTab | string | The value of the current active tab. |
<TabsList />
| Property | Type | Description |
|---|---|---|
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
activeTab | string | The value of the current active tab. |
<TabsButton />
| Property | Type | Description |
|---|---|---|
value | string | The unique ID of the panel to map this button to. |
disabled | boolean | Disables the button, skipping mouse/keyboard navigation and stopping events from firing. |
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
active | boolean | True if the item is active. |
<TabsContent />
| Property | Type | Description |
|---|---|---|
value | string | The unique ID of the panel. |
ref | E | The reference to the underlying element. |
children | Snippet<[ S extends Record<string, any> ? S : never ]> | The default snippet to render. |
custom | Snippet<[ S extends Record<string, any> ? { props: P; state: S; } : { props: P; } ]> | Snippet to be used when wanting a custom implementation. This will tell Lithesome not the render the default element and any state along with it. |
| State | Type | Description |
|---|---|---|
active | boolean | True if the item is active. |