Skip to content

Tabs ​

A set of layered sections of content—known as tab panels—that are displayed one at a time.

Examples ​

Default ​

Account

Make changes to your account here. Click save when you're done.

vue
<script setup>
import {
  Tabs,
  TabsContent,
  TabsList,
  TabsTrigger,
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
  Button,
  Input,
  Label
} from '@empathyds/vue'
</script>

<Tabs default-value="account" class="w-100">
  <TabsList class="grid w-full grid-cols-2">
    <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="space-y-2">
        <div class="space-y-1">
          <Label for="name">Name</Label>
          <Input id="name" default-value="Pedro Duarte" />
        </div>
        <div class="space-y-1">
          <Label for="username">Username</Label>
          <Input id="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="space-y-2">
        <div class="space-y-1">
          <Label for="current">Current password</Label>
          <Input id="current" type="password" />
        </div>
        <div class="space-y-1">
          <Label for="new">New password</Label>
          <Input id="new" type="password" />
        </div>
      </CardContent>
      <CardFooter>
        <Button>Save password</Button>
      </CardFooter>
    </Card>
  </TabsContent>
</Tabs>

Props ​

Tabs ​

PropTypeDefaultDescription
defaultValuestring-The default value of the tabs.
modelValuestring-The controlled value of the tabs.
orientationhorizontal | verticalhorizontalThe orientation of the tabs.
dirltr | rtl-The reading direction of the tabs.
activationModeautomatic | manualautomaticThe activation mode of the tabs.

Events ​

Tabs ​

EventPayloadDescription
update:modelValuestringEvent handler called when the value changes.

Slots ​

Tabs ​

SlotDescription
defaultThe content of the tabs.

TabsList ​

SlotDescription
defaultThe content of the tabs list.

TabsTrigger ​

SlotDescription
defaultThe content of the trigger.

TabsContent ​

SlotDescription
defaultThe content of the tab panel.