> Source: https://laravilt.com/docs/schemas/components/tabs

# Tabs

Organize content into tabbed panels.

## Basic Usage

```php
<?php

use Laravilt\Schemas\Components\Tabs;
use Laravilt\Schemas\Components\Tab;
use Laravilt\Forms\Components\TextInput;

Tabs::make('settings')
    ->tabs([
        Tab::make('general')
            ->label('General')
            ->schema([
                TextInput::make('name'),
            ]),
        Tab::make('security')
            ->label('Security')
            ->schema([
                TextInput::make('password')->password(),
            ]),
    ]);
```

## Tab with Icon

```php
<?php

Tab::make('profile')
    ->label('Profile')
    ->icon('User')
    ->schema([...]);
```

## Tab with Badge

```php
<?php

Tab::make('notifications')
    ->label('Notifications')
    ->icon('Bell')
    ->badge('5')
    ->schema([...]);
```

## Persist Active Tab

```php
<?php

Tabs::make('settings')
    ->persistTabInQueryString()
    ->tabs([...]);
```

## Set Active Tab

```php
<?php

Tabs::make('settings')
    ->activeTab(1)  // Second tab (0-indexed)
    ->tabs([...]);
```

## Tabs Methods

| Method | Description |
|--------|-------------|
| `make(string)` | Create tabs |
| `tabs(array)` | Set tab array |
| `activeTab(int)` | Default tab index |
| `persistTabInQueryString(bool)` | Persist in URL |
| `getTabs()` | Get tabs array |

## Tab Methods

| Method | Description |
|--------|-------------|
| `make(string)` | Create tab |
| `label(string\|Closure)` | Tab label |
| `icon(string\|Closure)` | Lucide icon |
| `badge(string\|Closure)` | Badge text |
| `schema(array)` | Tab content |
| `getLabel()` | Get label |
| `getIcon()` | Get icon |
| `getBadge()` | Get badge |
| `getSchema()` | Get schema |

## Complete Example

```php
<?php

Tabs::make('user')
    ->persistTabInQueryString()
    ->tabs([
        Tab::make('profile')
            ->label('Profile')
            ->icon('User')
            ->schema([
                TextInput::make('name'),
                TextInput::make('email'),
            ]),
        Tab::make('security')
            ->label('Security')
            ->icon('Shield')
            ->schema([
                TextInput::make('password')->password(),
            ]),
    ]);
```

## Related

- [Section](https://github.com/laravilt/laravilt/blob/HEAD/docs/schemas/components/section) - Grouped content
- [Wizard](https://github.com/laravilt/laravilt/blob/HEAD/docs/schemas/components/wizard) - Multi-step forms
