Tabs
Tab panels with labels, custom values and default index.
Last updated:
Tabs switch panels client-side via the runtime — no page reload. The tab list
is role="tablist" with proper aria-selected state.
Simple items
Section titled “Simple items”Items only
tabs({ items: ['Preview', 'Code', 'Notes'] });Panels with content
Section titled “Panels with content”Panels + label
Package manager
bun add @iconify-json/lucidenpm install @iconify-json/lucidepnpm add @iconify-json/lucidetabs({ label: 'Package manager', panels: [ { title: 'bun', content: code('bun add @iconify-json/lucide') }, { title: 'npm', content: code('npm install @iconify-json/lucide') }, { title: 'pnpm', content: code('pnpm add @iconify-json/lucide') }, ],});Non-default start index
Section titled “Non-default start index”defaultIndex = 2
Install and configure.
Import and call the builder.
Override icons and labels.
tabs({ defaultIndex: 2, panels: [ { title: 'Setup', content: '<p>Install and configure.</p>' }, { title: 'Usage', content: '<p>Import and call the builder.</p>' }, { title: 'Advanced', content: '<p>Override icons and labels.</p>' }, ],});itemsstring[]
Tab titles when
panels is omitted.panelsTabPanel[]
{ title?, value?, content } — content can be HTML.labelstring
Optional group label before the tab list.
Default
''defaultIndexnumber
Initially active tab.
Default
0value(when set) is used as thedata-cpd-tabvalue; otherwise it is derived from the title (title.toLowerCase().replace(/\s/, '-')).- Panels with no content (items-only mode) render an empty active panel.