Skip to content
Navigation

Tabs

Underlined or pill tabs with arrow-key navigation.

import
import { Tabs, TabList, Tab, TabPanel } from '@joshicodes/cock';

Variants

Panels only render while selected. Try the arrow keys once a tab has focus.

The underlined variant suits page-level navigation.

The last 7 days.

Keyboard

← →
Moves to the previous or next tab and selects it
Home / End
First and last tab

Behaviour

  • Panels only render while selected, so an expensive panel costs nothing until it is opened.
  • The strip scrolls sideways when the tabs do not fit, rather than wrapping or overflowing.

API

Read out of the component sources at build time, so it matches the version you installed. Every component also takes class, merged through tailwind-merge so your utility wins.

<Tabs>

Props

PropTypeDefault
value bindable
string''
variant
TabsVariant'line'
class
string—

Snippets

SnippetTypeDefault
children
Snippet—

<TabList>

Props

PropTypeDefault
class
string—

Snippets

SnippetTypeDefault
children
Snippet—

<Tab>

Props

PropTypeDefault
value required
string—
disabled
booleanfalse
class
string—

Snippets

SnippetTypeDefault
children
Snippet—

<TabPanel>

Props

PropTypeDefault
value required
string—
class
string—

Snippets

SnippetTypeDefault
children
Snippet—

See also

cock. Yes, it stands for core component kit. We checked twice.