Ship faster with goilerplate templUI Pro

Tabs

Navigation interface that organizes content into sections.

Source Tailwind CSS JavaScript

Account

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

Installation

templui add tabs

Load the script once in your layout:

<head>
  @tabs.Script()
</head>

API Reference

Required parameter
Hover for description

Tabs

Root container for the tabs component.

Name Type Default
ID

Unique identifier for the tabs container. Auto-generated if not provided.

string
-
Class

Additional CSS classes to apply to the tabs container.

string
-
Attributes

Additional HTML attributes to apply to the tabs container.

templ.Attributes
-

List

Container for tab triggers with styled background and indicator.

Name Type Default
ID

Unique identifier for the tab list element.

string
-
Class

Additional CSS classes to apply to the tab list.

string
-
Attributes

Additional HTML attributes to apply to the tab list element.

templ.Attributes
-

Trigger

Individual tab button that activates corresponding content.

Name Type Default
ID

Unique identifier for the tab trigger element.

string
-
Class

Additional CSS classes to apply to the tab trigger.

string
-
Attributes

Additional HTML attributes to apply to the tab trigger element.

templ.Attributes
-
Value

Unique value that identifies this tab and its corresponding content.

string
-
IsActive

Whether this tab is currently active/selected.

bool
false
TabsID

ID of the parent tabs container. Auto-detected if not provided.

string
-

Content

Container for tab content that shows when corresponding trigger is active.

Name Type Default
ID

Unique identifier for the tab content element.

string
-
Class

Additional CSS classes to apply to the tab content.

string
-
Attributes

Additional HTML attributes to apply to the tab content element.

templ.Attributes
-
Value

Value that matches the corresponding tab trigger.

string
-
IsActive

Whether this content is currently visible/active.

bool
false
TabsID

ID of the parent tabs container. Auto-detected if not provided.

string
-

JavaScript API

// Set active tab programmatically
window.tui.tabs.setActive("tabs-id", "tab-value");
Axel Adrian