The Tabs component is a flexible and customizable tab system that allows users to switch between different sections of content. It consists of Tabs, Tabs.List, Tabs.Trigger, and Tabs.Contentcomponents, making it modular and easy to use.
Make changes to your account here. Click save when you're done.
Make changes to your account here. Click save when you're done.
import { Tabs, Input } from "mogora-ui";
export default function TabsDemo() {
return (
<Tabs variant={"default"} defaultValue="item-1" className="flex flex-col w-lg">
<Tabs.List className="grid grid-cols-2">
<Tabs.Trigger value="item-1">Item 1</Tabs.Trigger>
<Tabs.Trigger value="item-2">Item 2</Tabs.Trigger>
</Tabs.List>
<Tabs.Content value="item-1" >
<Card className="w-full p-3 flex flex-col gap-2">
<h1 className="text-start font-bold w-full">Item 1</h1>
<p className="text-sm leading-4 font-medium text-slate-500">
Make changes to your account here. Click save when you're done.
</p>D
<Input className="focus:ring-slate-500" theme={"info"} placeholder="Email"/>
<Input className="focus:ring-slate-500" theme={"info"} placeholder="Username"/>
</Card>
</Tabs.Content>
<Tabs.Content value="item-2">
<Card className="w-full p-3 flex flex-col gap-2">
<h1 className="text-start font-bold w-full">Item 2</h1>
<p className="text-sm leading-4 font-medium text-slate-500">
Make changes to your account here. Click save when you're done.
</p>
<Input className="focus:ring-slate-500" theme={"info"} placeholder="Password"/>
<Input className="focus:ring-slate-500" theme={"info"} placeholder="Confirm"/>
</Card>
</Tabs.Content>
</Tabs>
)
}
The main Tabs component that provides tab functionality.
Prop | Type | Description |
---|---|---|
children | ReactNode | Elements to be rendered inside the Tabs component. |
defaultValue | string | The default active tab value. |
variant | "default" | "underline" | Determines the style of the Tabs component. |
size | "default" | "normal" | Defines the size of the Tabs component. |
className | string | Additional classes for styling. |
A wrapper component for tab triggers.
Prop | Type | Description |
---|---|---|
children | ReactNode | Tab trigger elements inside the List. |
className | string | Additional classes for styling. |
The button component that switches tabs.
Prop | Type | Description |
---|---|---|
children | ReactNode | Content inside the tab trigger. |
value | string | The value associated with the tab trigger. |
className | string | Additional classes for styling. |
The component that displays content based on the active tab.
Prop | Type | Description |
---|---|---|
children | ReactNode | Content inside the tab content section. |
value | string | The value associated with the content section. |
className | string | Additional classes for styling. |