Tabs
Tabs component with underline, pills and boxed styles, icons and arrow key navigation.
How to use it
Run npx @blossomui/react add tabs, or copy src/components/UI/Tabs/Tabs.tsx into your React project and import it.
import { Tabs } from './components/ui/Tabs'Props
Tab
| Prop | Type | Description |
|---|---|---|
| id (required) | string | |
| label (required) | string | |
| content (required) | ReactNode | |
| icon | ReactNode | |
| disabled | boolean |
TabsProps
| Prop | Type | Description |
|---|---|---|
| keepMounted | boolean | Keep the panels of the other tabs mounted (hidden), so they do not lose their state when you change tab. |
| color | string | Accent color of this component: any CSS color. Without it the component uses `--blossom-accent`, which is pink by default. |
| tabs (required) | Tab[] | |
| defaultValue | string | Id of the tab that starts selected when the component is not controlled. |
| value | string | Controlled selected tab. Use together with `onChange`. |
| onChange | (id: string) => void | |
| variant | 'underline' | 'pills' | 'boxed' | `underline` draws a line under the active tab, `pills` fills it and `boxed` puts the tabs in a container. |
| fullWidth | boolean | Make every tab take the same share of the width. |