Kwark. Design System
Open Kwark

Tabs

Sections of one thing, side by side. Never steps in a process.

ComponentsNavigationIn the app

Blank Pages · Feature film · Edited 16 Nov

<div data-sample-tabs>
<div class="kw-tabs" role="tablist" aria-label="Whose work to show"><button type="button" class="kw-tab" role="tab" id="shelf-mine" aria-controls="shelf-mine-panel" aria-selected="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z"/><path d="M15 3v6h6"/></svg>Your projects<em>4</em></button><button type="button" class="kw-tab" role="tab" id="shelf-shared" aria-controls="shelf-shared-panel" aria-selected="false" tabindex="-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8"/></svg>Shared with you<em>2</em></button></div>
<section role="tabpanel" id="shelf-mine-panel" aria-labelledby="shelf-mine" tabindex="0"><p>Blank Pages · Feature film · Edited 16 Nov</p></section>
<section role="tabpanel" id="shelf-shared-panel" aria-labelledby="shelf-shared" tabindex="0" hidden><p>What the Light Carries · Shared by Thea Experience</p></section>
</div>

What it is

Sections of one thing, side by side, with an underline under the open one. Home’s shelf is the reference: Your projects 4 · Shared with you 2, 44px tall, the count in a quieter 12px after the word.

Variants

Variant Where Look
Shelf Home (.home-shelf__tabs) 14px, 2px underline in --k-text
Story Character and research pages (.story-tabs) 12px, 12px top and bottom, 2px underline in the light accent, 24px apart

When not to use

Moving older code over

Tabs.tsx still draws 12px upper-case bold tabs with a gray-800 rule. Use the shelf or story look; keep its keyboard handling, which is right.

Anatomy

  1. Row: 24px between tabs, 1px --k-line under the row, scrolls sideways when it overflows.
  2. Tab: 44px tall, no padding, Poppins 400 14px, --k-text-2; optional 14px glyph (hidden on phones) and a 12px count.
  3. Selected: --k-text and an inset 2px underline in --k-text (--k-accent-soft in the story variant).

Tokens

Token Light Dark
--k-line #e2e8f0 rgba(255, 255, 255, .1)
--k-text #0f172a #e3e3e3
--k-text-2 #5b6779 #9ca3af
--k-accent-soft #e8b58b #e8b58b
--k-tap 44px
--k-fs-body 14px
--k-fs-meta 12px

React

In the Kwark app: import Tabs from '@/components/ui/Tabs'.

<Tabs tabs={[{ id: 'story', label: 'Story' }, { id: 'cast', label: 'Casting' }]} activeTab={tab} onChange={setTab} />
Prop Type Notes
tabs { id: string; label: string; icon?: LucideIcon }[]
activeTab string
onChange (id: string) => void
size 'sm' | 'md'

HTML and CSS

Works anywhere with kwark.css.

<div data-sample-tabs>
<div class="kw-tabs" role="tablist" aria-label="Whose work to show"><button type="button" class="kw-tab" role="tab" id="shelf-mine" aria-controls="shelf-mine-panel" aria-selected="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z"/><path d="M15 3v6h6"/></svg>Your projects<em>4</em></button><button type="button" class="kw-tab" role="tab" id="shelf-shared" aria-controls="shelf-shared-panel" aria-selected="false" tabindex="-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8"/></svg>Shared with you<em>2</em></button></div>
<section role="tabpanel" id="shelf-mine-panel" aria-labelledby="shelf-mine" tabindex="0"><p>Blank Pages · Feature film · Edited 16 Nov</p></section>
<section role="tabpanel" id="shelf-shared-panel" aria-labelledby="shelf-shared" tabindex="0" hidden><p>What the Light Carries · Shared by Thea Experience</p></section>
</div>
  • role="tablist", role="tab", aria-selected, aria-controls; panels role="tabpanel".
  • Left and right arrows move between tabs; only the selected tab is in the Tab order.

Rules

  • Never use tabs for a sequence of steps.
  • Must implement arrow-key navigation and roving tabindex.
  • Always make each tab reachable by URL.

AI readiness test

Task. Organise a location page with details, photos and scenes shot there.

Give the agent. Tabs, Navigation pattern.

Constraint. Each section must be linkable.

A reliable answer

  • Three tabs
  • URL changes per tab
  • Arrow keys work

Give this Markdown to your coding agent or share its URL.

Open .mdllms.txt
Loading…