1. Components
  2. tabs

Tabs

Segmented view switcher for organizing content within a page.

Demo

Installation

  1. Add the component

    Shell
    flexi-cli add tabs
  2. Install Dropdown

    This component require JS. By default we're using our own Interactive Component Library Flexilla . Install this only if you didn't accept dependencies installation during component addition.
    1. With Alpine
    2. Shell
      npm i @flexilla/alpine-tabs

      Add plugin in flexilla.js

      flexilla.js
      import AlpineTabs from "@flexilla/alpine-tabs"
      
      Alpine.plugin(AlpineTabs)
    3. Without Alpine
    4. Make sure that the popover package is not installed
      Shell
      npm i @flexilla/tabs

      Initialize tabs in flexilla.js

      flexilla.js
      import { 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.