Component
Tabs
Tabs
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.
Installation
Install the following dependencies
npm i @radix-ui/react-tabs
Copy and paste the following code into your project
components/ui/tabs/index.tsx
'use client'
import * as TabsPrimitive from '@radix-ui/react-tabs'
import { createStyleContext } from '@shadow-panda/style-context'
import { styled } from '@shadow-panda/styled-system/jsx'
import { tabs } from '@shadow-panda/styled-system/recipes'
const { withProvider, withContext } = createStyleContext(tabs)
export const Tabs = withProvider(styled(TabsPrimitive.Root), 'root')
export const TabsList = withContext(styled(TabsPrimitive.List), 'list')
export const TabsTrigger = withContext(styled(TabsPrimitive.Trigger), 'trigger')
export const TabsContent = withContext(styled(TabsPrimitive.Content), 'content')
Update the import paths to match your project setup
Usage
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
<Tabs defaultValue="account" w="400px">
<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>
Examples
Alternate styles
Content 1