--- title: "tabs" description: "Tabbed interface; panels supplied via named slots." category: "Navigation" --- # tabs Tabbed interface; panels supplied via named slots. ## Installation ```bash php artisan ui:add tabs ``` ## Dependencies - composer: `gehrisandro/tailwind-merge-laravel` ## Usage ```blade Make changes to your account here. Change your password here. ``` ## Example The demo rendered on the docs page. ```blade
Make changes to your account here.
Change your password here.
``` ## Source Copy this file to the path shown above it. `resources/views/components/ui/tabs.blade.php` ```blade @props([ 'tabs' => [], 'default' => null, ]) @php $active = $default ?? array_key_first($tabs); $listClasses = \TailwindMerge\Laravel\Facades\TailwindMerge::merge( 'inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground', $attributes->get('class'), ); $tabClasses = 'inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] aria-selected:bg-background aria-selected:text-foreground aria-selected:shadow-sm focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50'; @endphp {{-- The key lives on the data-ui-* attribute itself. A plain `data-tab` would be far too common a name to put in a file that gets copied into someone else's app. --}}
except('class') }}>
@foreach ($tabs as $key => $label) @endforeach
@foreach ($tabs as $key => $label)
{{ ${'tab_' . $key} ?? '' }}
@endforeach
@once @endonce ``` ## Theme tokens `--muted`, `--muted-foreground`, `--background`, `--foreground`, `--ring` Ships its own inline