Components
Tabs
Tabbed interfaces with keyboard navigation, horizontal or vertical.
Installation
Install @vinui/react from GitHub with pnpm, then import its stylesheet once, in your root layout or entry file:
pnpm add github:vindotski/vinui#path:packages/react
import '@vinui/react/styles.css';
Usage
Switch between panels of content, built on Headless UI's Tabs:
import { Tab, TabGroup, TabList, TabPanel, TabPanels } from '@vinui/react';
<TabGroup>
<TabList aria-label="Settings">
<Tab>Account</Tab>
<Tab>Billing</Tab>
</TabList>
<TabPanels>
<TabPanel>Name, email and photo.</TabPanel>
<TabPanel>Plan and invoices.</TabPanel>
</TabPanels>
</TabGroup>;
- Arrow keys move between tabs. Focusing a tab selects it; pass
manualto require Enter or Space instead. verticallays the tabs out beside the panels (Up/Down arrows move between them).- Use
defaultIndex, orselectedIndexwithonChangeto control the selected tab. Icons can go inside aTab.
More to come
Detailed examples, keyboard interaction and the full component API are on their way.