DocsComponentsTemplatesThemesGitHub

Tabs

Underline or pill tabs with keyboard arrows; optional panels via `content`.

Code

import * as React from 'react';
import { Tabs } from '@fruit-labs/design';

export default function Demo() {
  return (
    <div
      style={{
        display: 'flex',
        flexDirection: 'column',
        gap: 20,
      }}
    >
      <Tabs
        tabs={[
          'Overview',
          'Activity',
          {
            value: 'files',
            label: 'Files',
            count: 12,
          },
          'Settings',
        ]}
      />
      <Tabs variant="pill" tabs={['All', 'Open', 'Closed']} defaultValue="Open" />
    </div>
  );
}

With content

import { Tabs } from '@fruit-labs/design';

export default function Example() {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 12, maxWidth: 560 }}>
      <Tabs tabs={[
        { value: 'a', label: 'Profile', content: <p>Your public details.</p> },
        { value: 'b', label: 'Billing', content: <p>Cards and invoices.</p> },
      ]} />
    </div>
  );
}

Install

From npm:

npm install @fruit-labs/design

import { Tabs } from '@fruit-labs/design';

Or copy the TypeScript source into your project:

npx shadcn@latest add https://design.fruitlabs.online/r/tabs.json

Guidelines

  • Underline for page sections; pill for compact switching inside a card.

Props

PropTypeRequired
tabsArray<string | { value: string; label: React.ReactNode; icon?: string; count?: number; content?: React.ReactNode }>Yes
valuestringNo
defaultValuestringNo
onChange(value: string) => voidNo
variant'underline' | 'pill'No
classNamestringNo
styleReact.CSSPropertiesNo

Edit this example on GitHub