Tabs
Switches between related panels.
See it and copy it
Framework example
Choose Astro, React, or Elements to compare native usage against the shared visual output. Each example assumes the framework-level setup is already complete.
All primitives are available as Astro components.
The same API surface is available in React.
Standards-based custom elements bring Lumen to framework-neutral pages.
React Native consumes the shared tokens and native component contracts.
SwiftUI provides native Apple-platform primitives.
Compose provides native Android and Wear OS primitives.
View Tabs code
Framework usage
Switch targets to compare the adapter code. This live preview runs the Astro example. React and Elements use their own behavior APIs; complete the matching framework setup before copying an example.---
import {
Tabs,
TabsList,
TabsPanel,
TabsTrigger
} from '@santi020k/lumen-astro'
---
<Tabs initialValue="astro">
<TabsList aria-label="Package targets">
<TabsTrigger value="astro">Astro</TabsTrigger>
<TabsTrigger value="react">React</TabsTrigger>
<TabsTrigger value="elements">Elements</TabsTrigger>
<TabsTrigger value="react-native">React Native</TabsTrigger>
<TabsTrigger value="swiftui">SwiftUI</TabsTrigger>
<TabsTrigger value="compose">Compose</TabsTrigger>
</TabsList>
<TabsPanel value="astro">
<p>All primitives are available as Astro components.</p>
</TabsPanel>
<TabsPanel value="react">
<p>The same API surface is available in React.</p>
</TabsPanel>
<TabsPanel value="elements">
<p>Standards-based custom elements bring Lumen to framework-neutral pages.</p>
</TabsPanel>
<TabsPanel value="react-native">
<p>React Native consumes the shared tokens and native component contracts.</p>
</TabsPanel>
<TabsPanel value="swiftui">
<p>SwiftUI provides native Apple-platform primitives.</p>
</TabsPanel>
<TabsPanel value="compose">
<p>Compose provides native Android and Wear OS primitives.</p>
</TabsPanel>
</Tabs>import {
Tabs,
TabsList,
TabsPanel,
TabsTrigger
} from '@santi020k/lumen-react'
export const Example = () => (
<>
<Tabs defaultValue="astro">
<TabsList aria-label="Package targets">
<TabsTrigger value="astro">Astro</TabsTrigger>
<TabsTrigger value="react">React</TabsTrigger>
<TabsTrigger value="elements">Elements</TabsTrigger>
<TabsTrigger value="react-native">React Native</TabsTrigger>
<TabsTrigger value="swiftui">SwiftUI</TabsTrigger>
<TabsTrigger value="compose">Compose</TabsTrigger>
</TabsList>
<TabsPanel value="astro">
<p>All primitives are available as Astro components.</p>
</TabsPanel>
<TabsPanel value="react">
<p>The same API surface is available in React.</p>
</TabsPanel>
<TabsPanel value="elements">
<p>Standards-based custom elements bring Lumen to framework-neutral pages.</p>
</TabsPanel>
<TabsPanel value="react-native">
<p>React Native consumes the shared tokens and native component contracts.</p>
</TabsPanel>
<TabsPanel value="swiftui">
<p>SwiftUI provides native Apple-platform primitives.</p>
</TabsPanel>
<TabsPanel value="compose">
<p>Compose provides native Android and Wear OS primitives.</p>
</TabsPanel>
</Tabs>
</>
)<script type="module">
import { defineLumenElements } from '@santi020k/lumen-elements/define'
defineLumenElements()
</script>
<lumen-tabs initial-value="astro">
<TabsList aria-label="Package targets">
<TabsTrigger value="astro">Astro</TabsTrigger>
<TabsTrigger value="react">React</TabsTrigger>
<TabsTrigger value="elements">Elements</TabsTrigger>
<TabsTrigger value="react-native">React Native</TabsTrigger>
<TabsTrigger value="swiftui">SwiftUI</TabsTrigger>
<TabsTrigger value="compose">Compose</TabsTrigger>
</TabsList>
<TabsPanel value="astro">
<p>All primitives are available as Astro components.</p>
</TabsPanel>
<TabsPanel value="react">
<p>The same API surface is available in React.</p>
</TabsPanel>
<TabsPanel value="elements">
<p>Standards-based custom elements bring Lumen to framework-neutral pages.</p>
</TabsPanel>
<TabsPanel value="react-native">
<p>React Native consumes the shared tokens and native component contracts.</p>
</TabsPanel>
<TabsPanel value="swiftui">
<p>SwiftUI provides native Apple-platform primitives.</p>
</TabsPanel>
<TabsPanel value="compose">
<p>Compose provides native Android and Wear OS primitives.</p>
</TabsPanel>
</lumen-tabs>Framework differences
React: Use defaultValue for the initial selection, or value and onValueChange for controlled tabs. Astro names its initial selection initialValue.
Choose your target
Add this component
Choose the package for your runtime. All adapters share the Lumen stylesheet. Use the matching registry command when you want a local wrapper for that framework.
pnpm add @santi020k/lumen-astropnpm add @santi020k/lumen-astrolumen add Tabslumen add Tabspnpm add @santi020k/lumen-reactpnpm add @santi020k/lumen-reactlumen add Tabs --target reactlumen add Tabs --target reactpnpm add @santi020k/lumen-elementspnpm add @santi020k/lumen-elementslumen add Tabs --target elementslumen add Tabs --target elementsGlass
Add the glass prop to apply the shared blur, saturation, border, and highlight tokens. Glass reads best over vivid content, so place the surface above imagery or color.
View Tabs code
Framework usage
Switch targets to compare the adapter code. This live preview runs the Astro example. React and Elements use their own behavior APIs; complete the matching framework setup before copying an example.---
import { Tabs } from '@santi020k/lumen-astro'
---
<div class="docs-glass-demo">
<Tabs glass>
<div role="tablist">
<button role="tab" aria-selected="true">Preview</button>
<button role="tab">Code</button>
<button role="tab">Tokens</button>
</div>
<section role="tabpanel">Glass tabs get a translucent tab list, and the selected tab reads as a raised sliver of glass.</section>
</Tabs>
</div>import { Tabs } from '@santi020k/lumen-react'
export const Example = () => (
<>
<div className="docs-glass-demo">
<Tabs glass>
<div role="tablist">
<button role="tab" aria-selected="true">Preview</button>
<button role="tab">Code</button>
<button role="tab">Tokens</button>
</div>
<section role="tabpanel">Glass tabs get a translucent tab list, and the selected tab reads as a raised sliver of glass.</section>
</Tabs>
</div>
</>
)<script type="module">
import { defineLumenElements } from '@santi020k/lumen-elements/define'
defineLumenElements()
</script>
<div class="docs-glass-demo">
<lumen-tabs glass>
<div role="tablist">
<button role="tab" aria-selected="true">Preview</button>
<button role="tab">Code</button>
<button role="tab">Tokens</button>
</div>
<section role="tabpanel">Glass tabs get a translucent tab list, and the selected tab reads as a raised sliver of glass.</section>
</lumen-tabs>
</div>API reference
Lumen-specific props and runtime attributes for the Astro primitive. Use the framework differences above and the copyable examples for React composition and Elements attributes; the public adapter types define their supported contracts.
| Attribute | Values | Default | Description |
|---|---|---|---|
| glass | boolean | "subtle" | "strong" | false | Applies the tokenized liquid-glass surface treatment with backdrop-filter fallbacks; "subtle" and "strong" adjust the fill intensity. |
| indicator | boolean | false | Adds a decorative moving marker to the selected tab. System and local reduced motion keep selection immediate. |
| [role="tablist"] | child container | required | Groups the tab controls. |
| [role="tab"] | child control | required | Pairs with a panel by data-value or source order; the Astro runtime generates stable ARIA relationships. |
| [role="tabpanel"] | child panel | required | Pairs with a tab by data-value or source order and hides when inactive. |
| initialValue | string | - | Astro: selects the matching data-value before interaction. |
| storageKey | string | - | Astro: persists selection and synchronizes tab groups that share this key. |
| ui:tabs-change | CustomEvent<LumenTabsChangeDetail> | - | Astro and Elements: reports the selected value; narrow horizontal lists keep the active trigger visible. |
| class, className | string | "" | Merges custom classes with the generated ui-* root classes. |
| ...native attributes | HTML attributes | - | Forwards standard attributes to the root element unless the component consumes them. |
Keyboard interactions
Keyboard behavior provided by the Astro UIPrimitives runtime for this component.
| Key | Action |
|---|---|
| ArrowRight | Activate and focus the next tab, wrapping at the end. |
| ArrowLeft | Activate and focus the previous tab, wrapping at the start. |
| Home, End | Activate and focus the first or last tab. |
Runtime events
CustomEvents dispatched by the Astro UIPrimitives runtime for this component.
| Event | Target | Detail | When |
|---|---|---|---|
| ui:tabs-change | Tabs root ([data-ui-tabs]) | { storageKey?: string, value: string } | Fires after pointer or keyboard activation changes the selected tab. |