Loading preview
Animated Tabs
NavigationTabs with a sliding underline and fading panels, following the WAI-ARIA tabs pattern.
A single-choice switcher with a highlight that slides to the selected option.
npx shadcn@latest add @venusui/segmented-controlRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/segmented-control.tsxThe code behind the preview above.
segmented-control-demo.tsx
"use client"
import * as React from "react"
import { SegmentedControl } from "@/components/ui/segmented-control"
export default function SegmentedControlDemo() {
const [view, setView] = React.useState("preview")
return (
<div className="flex flex-col items-center gap-4">
<SegmentedControl
label="View"
value={view}
onValueChange={setView}
options={[
{ value: "preview", label: "Preview" },
{ value: "code", label: "Code" },
{ value: "docs", label: "Docs" },
]}
/>
<p className="text-sm text-muted-foreground">Selected: {view}</p>
</div>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| options | { value: string; label: ReactNode; disabled?: boolean }[] | — | The choices. Required. |
| label | string | — | Accessible name for the group, e.g. "View". Required. |
| value | string | — | Selected value when controlled. |
| defaultValue | string | first option | Initial value when uncontrolled. |
| onValueChange | (value: string) => void | — | Called when the selection changes. |
| className | string | — | Classes for the group container. |
Only the props above.
motion package. The CLI installs it.value + onValueChange) to switch views, filters or billing periods.label for icon-only segments, and add aria-label text inside so they stay accessible.layoutId.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.Tabs with a sliding underline and fading panels, following the WAI-ARIA tabs pattern.
A row of icons that magnify as the mouse approaches, like the macOS dock.
A CSS-only cube with six content faces that tumbles slowly and pauses on hover.