✨ Introducing NextLaunch — Premium templates designed to help you build stunning landing pages in minutes.

Tabs

A fully accessible and customizable tabbed interface component with support for controlled and uncontrolled modes.

Basic Example

Content for Tab 1

This is the content area for tab 1. You can put any content here.

Installation

1. Dependencies

npm install clsx tailwind-merge

2. Paste inside @/lib/utils.ts

import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: Parameters<typeof clsx>) {
  return twMerge(clsx(...inputs));
}

3. Copy Tabs Code

Loading...

Copy Tabs Code

Tabs Props

NameTypeRequiredDefaultDescription
defaultValuestringNoundefinedThe default value for the uncontrolled tabs. Represents the initially selected tab.
valuestringNoundefinedThe controlled value for the tabs. When provided, the component operates in controlled mode.
onValueChange(value: string) => voidNoundefinedCallback function that fires when the selected tab changes. Required for controlled usage.
childrenReact.ReactNodeYesundefinedThe content of the tabs component, typically includes TabsList and TabsContent components.
classNamestringNoundefinedAdditional class names for custom styling of the tabs container.

TabsList Props

NameTypeRequiredDefaultDescription
childrenReact.ReactNodeYesundefinedThe content of the tabs list, typically includes TabsTrigger components.
classNamestringNoundefinedAdditional class names for custom styling of the tabs list container.

TabsTrigger Props

NameTypeRequiredDefaultDescription
valuestringYesundefinedThe unique identifier for the tab that matches with the corresponding TabsContent value.
childrenReact.ReactNodeNoundefinedThe content of the tab trigger button, such as text or icons.
classNamestringNoundefinedAdditional class names for custom styling of the tab trigger button.
disabledbooleanNofalseWhether the tab trigger is disabled.

TabsContent Props

NameTypeRequiredDefaultDescription
valuestringYesundefinedThe unique identifier for the content that matches with the corresponding TabsTrigger value.
childrenReact.ReactNodeNoundefinedThe content to display when the tab is active.
classNamestringNoundefinedAdditional class names for custom styling of the tab content.