- Components
- tabs
Tabs
Segmented view switcher for organizing content within a page.
Demo
Installation
-
Install the component
Shellphp artisan flexi:add tabs -
Install dependencies
By default we're using our own Interactive Component Library Flexilla . Install this only if you did not accept dependency installation when adding the component.
Shellnpm i @flexilla/tabs -
Usage
1. With Alpine/Livewire
Add plugin in
flexilla.jsflexilla.jsimport { TabsPlugin } from "./plugins/tabs"; Alpine.plugin(TabsPlugin)2. Without Alpine
Initialize tabs in
flexilla.jsflexilla.jsimport { Tabs } from "@flexilla/tabs" // init Tabs for all Element with data-app-tabs attribute Tabs.autoInit('[data-app-tabs]')
Examples
Form
References
Tabs Component
The tabs component creates a tabbed interface for organizing content into separate views.
| Prop | Type | Default | Description |
|---|---|---|---|
class
|
string | '' | Additional CSS classes for the tabs container. |
Subcomponents
| Component | Description |
|---|---|
x-ui.tabs.list-wrapper
|
Optional wrapper component for the tabs list. |
x-ui.tabs.list
|
The container for tab triggers. Should contain one or more x-ui.tabs.trigger
components.
|
x-ui.tabs.trigger
|
The clickable tab trigger. Must have an 'id' attribute that matches a corresponding panel's 'id'. Accepts a 'class' prop for custom styling. |
x-ui.tabs.panel-wrapper
|
Optional wrapper for tab panels. Can be used to add a common container around all panels. |
x-ui.tabs.panel
|
The content panel for a tab. Must have an 'id' attribute that matches a trigger's 'id'. Accepts 'show-as-grid' prop to use CSS Grid for layout. Use the 'active' prop to set the initially visible panel. |
Events
| Event | Description |
|---|---|
tab:changed
|
Dispatched when the active tab changes. The event detail contains the ID of the newly active tab. |
JavaScript API
To know more about the JavaScript API, check the Flexilla documentation.