Tabs

A set of layered sections of content, known as tab panels, that display one panel of content at a time.

Installation

Import the component from the passport-ui package.

components/example.tsx
1
2
3
import { Tabs, TabsContent, TabsList, TabsTrigger } from "passport-ui";
import { Card, CardContent } from "passport-ui";
import { Home, BarChart3, Settings } from "lucide-react";

Usage

Basic example showing how to use the component.

components/example.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<Tabs defaultValue="overview" className="w-md">
<TabsList>
<TabsTrigger value="overview" icon={Home}>
Overview
</TabsTrigger>
<TabsTrigger value="analytics" icon={BarChart3}>
Analytics
</TabsTrigger>
<TabsTrigger value="settings" icon={Settings}>
Settings
</TabsTrigger>
</TabsList>
<TabsContent value="overview">
<Card>
<CardContent>
<h3 className="text-lg font-semibold">Project Overview</h3>
<p className="text-sm text-muted-foreground mt-2">
View your project's current status, recent activity, and
key metrics all in one place.
</p>
<div className="mt-4 space-y-2">
<div className="flex justify-between text-sm">
<span>Active tasks:</span>
<span className="font-medium">12</span>
</div>
<div className="flex justify-between text-sm">
<span>Completed:</span>
<span className="font-medium">8</span>
</div>
</div>
</CardContent>
</Card>
</TabsContent>
<TabsContent value="analytics">
<Card>
<CardContent>
<h3 className="text-lg font-semibold">Analytics Dashboard</h3>
<p className="text-sm text-muted-foreground mt-2">
Track performance metrics and growth trends.
</p>
<div className="mt-4 grid grid-cols-2 gap-4 text-center">
<div>
<div>2.4k</div>
<div className="text-xs text-muted-foreground">Users</div>
</div>
<div>
<div>18%</div>
<div className="text-xs text-muted-foreground">Growth</div>
</div>
</div>
</CardContent>
</Card>
</TabsContent>
<TabsContent value="settings">
<Card>
<CardContent>
<h3 className="text-lg font-semibold">Settings</h3>
<p className="text-sm text-muted-foreground mt-2">
Configure your preferences and application settings.
</p>
</CardContent>
</Card>
</TabsContent>
</Tabs>

Additional resources

Documentation and examples are available in Storybook.