Tabs are used to switch between different views of a component.

React is a JavaScript library for building user interfaces.
React
"use client" import Tabs from "@radui/ui/Tabs"; import { useState } from "react"; const items = [ { id: "react", title: "React", content: "React is a JavaScript library for building user interfaces." }, { id: "angular", title: "Angular", content: "Angular is a platform and framework for building single-page client applications using HTML and TypeScript." }, { id: "vue", title: "Vue", content: "Vue.js is a progressive framework for building user interfaces." } ] const TabsExample = () => { const [activeTab, setActiveTab] = useState(items[0].id); return <div className="w-64 md:w-96"> <Tabs.Root value={activeTab} onValueChange={setActiveTab}> <Tabs.List> {items.map((item) => ( <Tabs.Trigger key={item.id} value={item.id}>{item.title}</Tabs.Trigger> ))} </Tabs.List> {items.map((item) => ( <Tabs.Content key={item.id} value={item.id}>{item.content}</Tabs.Content> ))} </Tabs.Root> </div> } export default TabsExample;

Import all parts of the component and piece them together

React
import Tabs from "@radui/ui/Tabs"; export default () => { return ( <Tabs.Root> <Tabs.List> <Tabs.Trigger /> </Tabs.List> <Tabs.Content /> </Tabs.Root> ) }

The root component for the Tabs.

PropTypeDefault

className

string--

customRootClass

string--

children

ReactNode

value

string--

color

string--

defaultValue

string--

onValueChange

function--

orientation

enum

horizontal

dir

enum

ltr

activationMode

enum

automatic

asChild

boolean

false

The trigger component for the Tabs. This component is used to toggle the visibility of the Tab.

PropTypeDefault

className

string--

children

ReactNode

disabled

boolean

false

value

string--

asChild

boolean

false

The list component for the Tabs. This component is used to display the list of Tabs.

PropTypeDefault

className

string--

children

ReactNode

asChild

boolean

false

The content component for the Tabs. This component is used to display the content of the Tabs.

PropTypeDefault

className

string--

value

string--

children

ReactNode--

customRootClass

string--

asChild

boolean

false

forceMount

boolean

false