Neura UI

Loading…

 Logo

Tabs

Tab component for organizing content into separate views that users can switch between

Basic Usage

The most basic tabs component with list, triggers, and content:
blade

Overview

This is the overview content. It provides a general introduction to the topic.

<neura::tabs defaultTab="overview">
    <neura::tabs.list>
        <neura::tabs.trigger value="overview">Overview</neura::tabs.trigger>
        <neura::tabs.trigger value="features">Features</neura::tabs.trigger>
        <neura::tabs.trigger value="pricing">Pricing</neura::tabs.trigger>
    </neura::tabs.list>

    <neura::tabs.content value="overview">
        Content for overview tab
    </neura::tabs.content>

    <neura::tabs.content value="features">
        Content for features tab
    </neura::tabs.content>

    <neura::tabs.content value="pricing">
        Content for pricing tab
    </neura::tabs.content>
</neura::tabs>

Variants

The tabs component supports two variants: line (default) and pills :

Line Variant (Default)

Preview

Content for Tab 1 with line variant.

Pills Variant

With Livewire

The tabs component automatically synchronizes state with Livewire via @entangle if an activeTab property exists in the Livewire component:
blade

Overview

Current active tab: None

Settings

Current active tab: None

Profile

Current active tab: None

<neura::tabs>
    <neura::tabs.list>
        <neura::tabs.trigger value="overview">Overview</neura::tabs.trigger>
    </neura::tabs.list>
    ...
</neura::tabs>

// In your Livewire component:
public $activeTab = null;

With Icons

Add icons to tabs to improve visual understanding:
blade

Welcome home!

<neura::tabs.trigger value="home" class="gap-2">
    <neura::icon name="home" class="size-4" />
    Home
</neura::tabs.trigger>

Rich Content

Tabs can contain rich content with complex components:

Product Overview

This product offers exceptional value with a comprehensive set of features.

Use Cases

Product Details Page

Product description content.

Settings Panel

Account settings content.

Best Practices

Do

  • Use clear and descriptive labels for tabs
  • Organize content logically by categories
  • Limit the number of tabs (3-5 maximum recommended)
  • Use defaultTab to set the default active tab
  • Add icons to improve navigation

Don't

  • Don't create too many tabs (max 5-7)
  • Don't use overly long labels
  • Don't put too much content in a single tab
  • Don't forget to sync state with Livewire if necessary

Properties

Component Property Type Default Description
tabs variant string 'line' Tab style: 'line' or 'pills'
defaultTab string|null null Default active tab (otherwise the first one)
tabs.list variant string 'line' List style: 'line' or 'pills'
tabs.trigger value string required Unique tab identifier (must match the content)
variant string 'line' Trigger style: 'line' or 'pills'
tabs.content value string required Unique identifier that matches the trigger