Tabs
A tabs component organizes content into multiple sections, allowing users to switch between different views or groups of content within the same space.
Usage
Tab: A Tab component groups multiple TabItems, allowing users to switch between different sections of content.TabItem: A TabItem represents an individual tab and its associated content within a Tab component.
- Contacts Tab
<script> import { Tabs, TabItem } from 'deskblocks'; </script> <Tabs> <TabItem title="contact" open>Contacts Tab</TabItem> <TabItem title="account">Accounts Tab</TabItem> </Tabs>
Notes:
- Pass the
openprop to a TabItem to set it as active. - If none of the TabItems have the
openprop, no tab will be selected.
Background
Pass the background prop to apply a background color to the tabs.
- Accounts Tab
<script> import { Tabs, TabItem } from 'deskblocks'; </script> <Tabs background> <TabItem title="contact">Contacts Tab</TabItem> <TabItem title="account" open>Accounts Tab</TabItem> </Tabs>
Slots
default
TabItem Props
open | boolean | undefined | Indicates whether the tab is currently active and its content is visible. |
title | string | undefined | Sets the label or title displayed on the tab. |
class | string | undefined | Custom CSS class for additional styling of the tab item. |
Events
on:change: fires onTabswhen the selected tab changes after mount; the initial selection made while the tabs mount does not dispatch it.event.detailis{ node, title }, wherenodeis the newly shown panel element (nullif no tab is selected) andtitleis thetitleof the selected TabItem (an empty string when unavailable).