Sections
Get Started
Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Fancy Button
- Field
- Filter
- Form
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Number Field
- Pagination
- Pin Input
- Popover
- Progress
- Radio Group
- Radio Stack
- Range Calendar
- Range Slider
- Rating
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stepper
- Swatch
- Swatch Group
- Switch
- Table
- Tabs
- Tags Input
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Forms
A set of layered sections of content—known as tab panels—that are displayed one at a time.
Account
Make changes to your account here. Click save when you're done.
<script setup lang="ts">
import { Button } from '@/components/ui/button'
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from '@/components/ui/tabs'
</script>
<template>
<div class="flex w-full max-w-sm flex-col gap-6">
<Tabs default-value="account">
<TabsList>
<TabsTrigger value="account">
Account
</TabsTrigger>
<TabsTrigger value="password">
Password
</TabsTrigger>
</TabsList>
<TabsContent value="account">
<Card>
<CardHeader>
<CardTitle>Account</CardTitle>
<CardDescription>
Make changes to your account here. Click save when you're
done.
</CardDescription>
</CardHeader>
<CardContent class="grid gap-6">
<div class="grid gap-3">
<Label for="tabs-demo-name">Name</Label>
<Input id="tabs-demo-name" default-value="Pedro Duarte" />
</div>
<div class="grid gap-3">
<Label for="tabs-demo-username">Username</Label>
<Input id="tabs-demo-username" default-value="@peduarte" />
</div>
</CardContent>
<CardFooter>
<Button>Save changes</Button>
</CardFooter>
</Card>
</TabsContent>
<TabsContent value="password">
<Card>
<CardHeader>
<CardTitle>Password</CardTitle>
<CardDescription>
Change your password here. After saving, you'll be logged
out.
</CardDescription>
</CardHeader>
<CardContent class="grid gap-6">
<div class="grid gap-3">
<Label for="tabs-demo-current">Current password</Label>
<Input id="tabs-demo-current" type="password" />
</div>
<div class="grid gap-3">
<Label for="tabs-demo-new">New password</Label>
<Input id="tabs-demo-new" type="password" />
</div>
</CardContent>
<CardFooter>
<Button>Save password</Button>
</CardFooter>
</Card>
</TabsContent>
</Tabs>
</div>
</template>Installation
pnpm dlx @frontic/ui add tabs
Frontic UI Extensions
Frontic UI extends this component with additional variants: default (pill-style) and underline (border-bottom indicator).
Install the extended version:
pnpm dlx @frontic/ui add tabs
Underline Variant
The underline variant provides a minimal tab style with a bottom border indicator, ideal for navigation-style tabs.
Overview content goes here. This is the underline tab variant.
<script setup lang="ts">
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from '@/components/ui/tabs'
</script>
<template>
<Tabs default-value="overview" variant="underline" class="w-full max-w-md">
<TabsList>
<TabsTrigger value="overview">
Overview
</TabsTrigger>
<TabsTrigger value="analytics">
Analytics
</TabsTrigger>
<TabsTrigger value="reports">
Reports
</TabsTrigger>
</TabsList>
<TabsContent value="overview" class="p-4">
<p class="text-sm text-muted-foreground">
Overview content goes here. This is the underline tab variant.
</p>
</TabsContent>
<TabsContent value="analytics" class="p-4">
<p class="text-sm text-muted-foreground">
Analytics content goes here.
</p>
</TabsContent>
<TabsContent value="reports" class="p-4">
<p class="text-sm text-muted-foreground">
Reports content goes here.
</p>
</TabsContent>
</Tabs>
</template>Usage
<script setup lang="ts">
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
</script>
<template>
<Tabs default-value="account">
<TabsList>
<TabsTrigger value="account">
Account
</TabsTrigger>
<TabsTrigger value="password">
Password
</TabsTrigger>
</TabsList>
<TabsContent value="account">
Make changes to your account here.
</TabsContent>
<TabsContent value="password">
Change your password here.
</TabsContent>
</Tabs>
</template>With Variant Prop
Use the variant prop on Tabs to set the style for all child components:
<template>
<Tabs default-value="tab1" variant="underline">
<TabsList>
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
</TabsList>
<TabsContent value="tab1">Content 1</TabsContent>
<TabsContent value="tab2">Content 2</TabsContent>
</Tabs>
</template>