Tabs

Organize content to sections.

Preview
Code

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 />

PropertyTypeDescription
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.

StateTypeDescription
activeTabstringThe value of the current active tab.

<TabsList />

PropertyTypeDescription
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.

StateTypeDescription
activeTabstringThe value of the current active tab.

<TabsButton />

PropertyTypeDescription
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.

StateTypeDescription
activebooleanTrue if the item is active.

<TabsContent />

PropertyTypeDescription
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.

StateTypeDescription
activebooleanTrue if the item is active.