Tabs

Radix tabs with a sketch underline under the active trigger. Switching tabs slides the rule and redraws it with a derived seed.

Real HTML under a sketch underline.
<Tabs defaultValue="ink" roughness={1.5}>
  <TabList>
    <Tab value="ink">Ink</Tab>
    <Tab value="wash">Wash</Tab>
  </TabList>
  <TabPanel value="ink">Real HTML under a sketch underline.</TabPanel>
  <TabPanel value="wash">Switching tabs redraws the rule.</TabPanel>
</Tabs>

CLI install

npx doodleui-react add tabs

Usage

import { Tabs, TabList, Tab, TabPanel } from "doodleui-react";

<Tabs defaultValue="ink">
  <TabList>
    <Tab value="ink">Ink</Tab>
    <Tab value="wash">Wash</Tab>
  </TabList>
  <TabPanel value="ink">Real HTML under a sketch underline.</TabPanel>
  <TabPanel value="wash">Switching tabs redraws the rule.</TabPanel>
</Tabs>

Arrow keys, aria-selected, and tab panels come from Radix. doodle-ui only draws the active underline.

Props

PropTypeDefaultNotes
defaultValue / valuestringrequiredActive tab. Switching redraws the underline with a derived seed.
onValueChange(value: string) => voidundefinedFires when the active tab changes.
animatebooleantrueActive underline redraws and slides to the selected tab. Overrides DoodleUIProvider. Reduced motion disables this unless the provider set forceAnimate.
roughnessnumber1.5How wobbly the stroke is. 0 is almost geometric. 3+ is messy.
seednumberprovider / randomLocks the sketch. Omit to follow SketchSeedProvider (Shuffle) or a mount-time random seed.
sketchColorstring#1f1d1aStroke color. Also tints primary/accent fills where relevant.
classNamestringundefinedPassed through to the root element.
styleCSSPropertiesundefinedPassed through to the root element.