Twigs Logo

Tabs

A set of layered sections of content that are displayed one at a time. Perfect for organizing related content into separate views.

Import

import { Tabs, TabsList, TabsTrigger, TabsContent } from "@sparrowengg/twigs-react";

Usage

const TabsExample = () => {
  return (
    <Tabs defaultValue="account">
      <TabsList aria-label="Account settings">
        <TabsTrigger value="account">Account</TabsTrigger>
        <TabsTrigger value="password">Password</TabsTrigger>
      </TabsList>
      
      <TabsContent value="account">
        <Box css={{ padding: "$6" }}>
          <Text>Make changes to your account here.</Text>
        </Box>
      </TabsContent>
      
      <TabsContent value="password">
        <Box css={{ padding: "$6" }}>
          <Text>Change your password here.</Text>
        </Box>
      </TabsContent>
    </Tabs>
  );
};

Props

Tabs

PropTypeDefault
defaultValue?
string
-
value?
string
-
onValueChange?
(value: string) => void
-
orientation?
'horizontal' | 'vertical'
'horizontal'
dir?
'ltr' | 'rtl'
-
activationMode?
'automatic' | 'manual'
'automatic'
css?
object
-

TabsList

PropTypeDefault
loop?
boolean
true
children?
ReactNode
-

TabsTrigger

PropTypeDefault
value?
string
-
disabled?
boolean
false
children?
ReactNode
-

TabsContent

PropTypeDefault
value?
string
-
forceMount?
boolean
-
children?
ReactNode
-

Data Attributes

These props are used for the conditional rendering of the components

Applicable - Tabs, TabsList
PropTypeDefault
[data-orientation]?
'vertical' | 'horizontal'
-
Applicable - TabsTrigger
PropTypeDefault
[data-state]?
'active' | 'inactive'
-
[data-disabled]?
boolean
-
[data-orientation]?
'vertical' | 'horizontal'
-
Applicable - TabsContent
PropTypeDefault
[data-state]?
'active' | 'inactive'
-
[data-orientation]?
'vertical' | 'horizontal'
-
Tabs | Twigs