Tabs

Description

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.

Usage

Item 1

Make changes to your account here. Click save when you're done.

Item 2

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>
  )
}
Variants

API Reference

Tabs

The main Tabs component that provides tab functionality.

PropTypeDescription
childrenReactNodeElements to be rendered inside the Tabs component.
defaultValuestringThe default active tab value.
variant"default" | "underline"Determines the style of the Tabs component.
size"default" | "normal"Defines the size of the Tabs component.
classNamestringAdditional classes for styling.

List

A wrapper component for tab triggers.

PropTypeDescription
childrenReactNodeTab trigger elements inside the List.
classNamestringAdditional classes for styling.

Trigger

The button component that switches tabs.

PropTypeDescription
childrenReactNodeContent inside the tab trigger.
valuestringThe value associated with the tab trigger.
classNamestringAdditional classes for styling.

Content

The component that displays content based on the active tab.

PropTypeDescription
childrenReactNodeContent inside the tab content section.
valuestringThe value associated with the content section.
classNamestringAdditional classes for styling.