AisTabs
Create a widget of tabbable panes of local content. The tabs component is built using a collection of AisTab components, and provides full keyboard navigation control of the tabs.
Basic usage
Users
Pills
Tabs use the tabs styling by default. Just add pills boolean prop to AisTabs for the pill style variant.
Users
Radio
Tabs use the tabs styling by default. Just add radio boolean prop to AisTabs for the radio button-group style variant.
Users
Fill & Justify
Force your tabs controls to extend the full available width.
Fill
To proportionately fill all available space with your tab controls, set the fill prop. Notice that all horizontal space is occupied, but not every control has the same width.
Attachments & Uploads
Justified
For equal-width controls, use the justify prop instead. All horizontal space will be occupied by the controls, but unlike using fill above, every control will be the same width.
Attachments & Uploads
Alignment
To align your tab controls, use the align prop. Available values are left, center, and right.
Users
Vertical
Have the tab controls placed to the left side of the tab panels by setting the vertical prop to true.
Users
Users Tab Panel
Users Tab Panel
Tabs on the right
Have the tab controls placed to the right side of the tab panels by setting the vertical prop to true and align="right".
Users
Users Tab Panel
Users Tab Panel
Slots
There are three slots on AisTabs:
before: The slot immediately before the tabs. In standard layout this is to the left of the tabs and inverticallayout, this is above the tabs.after: The slot immediately after the tabs. In standard layout, this is to the right of the tabs. Inverticallayout, this is below the tabs.between: This slot is between the tabs and the tab-panels. In standard layout, this is below the tabs and above the tab-panels. Inverticallayout, this is to the right of the tabs and to the left of the tab-panels.
"Before" slot
"After" slot
"Between" slot
Users
Users Tab Panel
Users Tab Panel
Complete Example
Users
Component Reference
Props
Property | Type(s) | Required | Default | Description | Deprecated |
|---|---|---|---|---|---|
| align | String | 'left' | Align the tab group Valid values: left, center, right | false | |
| defaultIndex | Number | 0 | The default selected index | false | |
| fill | Boolean | false | Use fill prop to proportionately occupy all available space. All horizontal space will be occupied, but
not every tab will have the same width. | false | |
| font | String | 'sans' | Set the font of the text inside of the badge Valid values: caps, sans, serif | false | |
| gap | String | undefined | Use the gap prop to control spacing between the tabs and tab-panels. The prop expects one of the Tailwind CSS gap
classes (e.g. gap-1, gap-10, etc...); see:
https://tailwindcss.com/docs/gap. | false | |
| justify | Boolean | false | Use justify prop for equal-width tabs. All horizontal space will be occupied, but unlike fill,
every tab will be the same width | false | |
| manual | Boolean | false | When true, the user can only display a panel via the keyboard by first navigating to it using the arrow keys, and
then by pressing Enter or Space. By default, panels are automatically displayed when navigated to
via the arrow keys. Note that this prop has no affect on mouse behavior. | false | |
| outline | Boolean | false | Applies one of the theme color variants to the border instead of the background. This replaces the
deprecated alternate prop | false | |
| panelsClass | Array, String | () => [] | Class(es) applied to the tab panels container | false | |
| pillGap | String | undefined | Use the pill-gap prop to control spacing between the pills/tabs. The prop expects one of the
Tailwind CSS gap classes (e.g. gap-1, gap-10, etc...); see:
https://tailwindcss.com/docs/gap.
Note: only applicable when the pills prop is set | false | |
| pills | Boolean | false | When true, the tabs will be styled like pills | false | |
| radio | Boolean | false | When true, the tabs will be styled like a radio button-group | false | |
| rounded | Boolean, String | undefined | Applies rounded corners using
TailwindCSS's rounded classes | false | |
| selectedIndex | Number | 0 | The selected index if you want to use the Tabs component as a controlled component. | false | |
| size | String | 'md' | Set the size of the component's appearance Valid values: xs, sm, md, lg, xl | false | |
| variant | String | 'default' | Applies one of the theme color variants to the component Valid values: primary, secondary, default, info, success, warning, danger, plain | false | |
| vertical | Boolean | false | When true, the orientation of the tab list will be vertical, otherwise it will be horizontal. | false | |
| alternate | Boolean | false | Removes the background color and applies one of the theme color variants to the border Deprecated - Replaced by outline | true |
Slots
Name | Scoped | Description |
|---|---|---|
| after | No | The slot immediately after the tabs. In standard layout this is to the right of the tabs and in vertical layout, this is below the tabs. |
| before | No | The slot immediately before the tabs. In standard layout this is to the left of the tabs, in vertical layout this is above the tabs. |
| between | No | This slot is between the tabs and the tab-panels. In standard layout, this is below the tabs and above the tab-panels. In vertical layout, this is to the right of the tabs and to the left of the tab-panels |
| default | Scoped slot for custom rendering the tabs |
Events
Event | Arguments | Description |
|---|---|---|
| change |
| Emitted when the tabs change |