Component
Tabs
Switching between panels of one page.
import { Tabs } from '@loidolt/theme-svelte';
Example
A small, coherent foundation for Loidolt applications.
Typed values and CSS custom properties stay in sync.
Import the stylesheet once, then the components you need.
Location, crop shape and size. Every panel stays mounted, so a hidden panel keeps its
state.
Outlines, carved depth and inserts, in one place.
Font, text size and the marks placed on the map.
Notes
- Defaults to the first tab, and falls back to it if the selected tab disappears — removing a tab cannot blank every panel.
- Every panel stays mounted and hidden while unselected, so panels keep their state.
variant="rail"is an icon rail for a settings sidebar: give each tab aniconsnippet and a short label, and the root a height so its panels scroll beside the rail. Switchorientationto horizontal where the layout stacks; a vertical rail also falls back to a row on phones.panelHeaderrenders shared content once above the panels, such as a filter field; the vertical rail pins it while the panels scroll.
Props
Generated from the component source, so it cannot drift from the implementation.
| Prop | Type | Default | Notes |
|---|---|---|---|
children required | Snippet<[{ value: T }]> | — | Every panel stays mounted, hidden while unselected, so a panel keeps its state and its controls can be found while another one shows. |
tabs required | TabItem<T>[] | — | |
class | string | — | |
contentClass | string | — | |
label | string | — | Accessible name of the tab list. |
listClass | string | — | |
onValueChange | (value: T) => void | — | |
orientation | Orientation | 'horizontal' | |
panelHeader | Snippet | — | Shared content above the panels, such as a filter or search; pinned while the rail's panels scroll. |
panelsClass | string | — | The element around the panels, present in the rail variant or with a panelHeader. |
ref bindable | HTMLElement | null | null | |
value bindable | T | tabs[0]?.value | Defaults to the first tab, so a panel is always rendered. |
variant | 'line' | 'rail' | 'line' | line underlines the selected tab. rail is an icon rail for a settings sidebar: short labels under icons, the list fixed beside (or above) panels that scroll on their own. |
Plus the attributes of Omit<
TabsRootProps,
'value' | 'onValueChange' | 'orientation' | 'children' | 'child' | 'class' | 'ref'
>, forwarded to the root element.