shadcn-templ 2.0 beta. Switch to templUI v1
1.7k

Tabs

A set of layered sections of content—known as tab panels—that are displayed one at a time.

Overview
View your key metrics and recent project activity. Track progress across all your active projects.
You have 12 active projects and 3 pending tasks.
package examples import (

Installation

shadcn-templ add tabs

Usage

import "github.com/axadrn/shadcn-templ/v2/components/tabs"
@tabs.Tabs(tabs.Props{DefaultValue: "account"}) {	@tabs.List() {		@tabs.Trigger(tabs.TriggerProps{Value: "account"}) {			Account		}		@tabs.Trigger(tabs.TriggerProps{Value: "password"}) {			Password		}	}	@tabs.Content(tabs.ContentProps{Value: "account"}) {		Account content.	}	@tabs.Content(tabs.ContentProps{Value: "password"}) {		Password content.	}}

Composition

Use the following composition to build Tabs:

tabs.Tabs├── tabs.List│   ├── tabs.Trigger│   └── tabs.Trigger├── tabs.Content└── tabs.Content

Line

Use the Variant: tabs.VariantLine prop on tabs.List for a line style.

package examples import "github.com/axadrn/shadcn-templ/v2/components/tabs"

Vertical

Use Orientation: tabs.OrientationVertical for vertical tabs.

package examples import "github.com/axadrn/shadcn-templ/v2/components/tabs"

Disabled

package examples import "github.com/axadrn/shadcn-templ/v2/components/tabs"

Icons

package examples import (

API Reference

Tabs

The tabs.Tabs component is the root, it shares the tabs id with list, triggers and contents.

Prop Type Default
DefaultValue string -
Orientation OrientationHorizontal | OrientationVertical horizontal
Class string -

TabsList

The tabs.List component wraps the triggers.

Prop Type Default
Variant VariantDefault | VariantLine default
Class string -

TabsTrigger

The tabs.Trigger component activates its tab panel.

Prop Type Default
Value string -
Disabled bool false
Class string -

TabsContent

The tabs.Content component is the tab panel.

Prop Type Default
Value string -
Class string -