Skip to content

Tabs

Download .md

Tabs switch between views of the same content, such as the summary, releases and royalties of one artist.

  • Use tabs for 2 to 6 views that sit at the same level.
  • Keep the content of every tab related; use separate pages for unrelated content.
  • Don’t use tabs as steps of a process; use a stepper.
React
12 rilis aktif bulan ini.
Vue
12 rilis aktif bulan ini.
1234
  1. 1Active tab
  2. 2Indicator on primary
  3. 3Tab
  4. 4Panel

A row of labels over a border line, and the content of the active tab below it. The active tab has foreground text and a 2px primary line under it; the others use muted-foreground. Tabs are 36px tall and never sit on a pill.

There is one style, horizontal or vertical (orientation="vertical"). In vertical tabs the line moves to the right edge.

React Vue Flutter Type Default Use
defaultValue / value default-value / v-model value string none The active tab.
onValueChange @update:model-value onChanged function none Runs when the tab changes.
orientation orientation none horizontal | vertical horizontal Direction of the tab list.
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
export default function TabsDemo() {
return (
<Tabs defaultValue="ringkasan" className="w-full max-w-md">
<TabsList>
<TabsTrigger value="ringkasan">Ringkasan</TabsTrigger>
<TabsTrigger value="rilis">Rilis</TabsTrigger>
<TabsTrigger value="royalti">Royalti</TabsTrigger>
</TabsList>
<TabsContent value="ringkasan" className="pt-3 text-muted-foreground">12 rilis aktif bulan ini.</TabsContent>
<TabsContent value="rilis" className="pt-3 text-muted-foreground">3 rilis menunggu dikirim.</TabsContent>
<TabsContent value="royalti" className="pt-3 text-muted-foreground">Laporan Oktober sudah masuk.</TabsContent>
</Tabs>
)
}
Terminal window
npx shadcn@latest add https://design.sosialoka.tech/r/react/tabs.json
  • Renders role="tablist", tab and tabpanel, with aria-selected on the active tab.
  • Arrow keys move between tabs; Tab moves into the panel.