OTabPane
OTabPane declares one tab of a parent OTabs: its value, its label, and the content, such as a component, shown when the tab is selected.
Usage
Step by step
- Import
OTabPanewithOTabsfrom theooko-ui/tabspublic subpath. - Place one
OTabPaneper tab directly insideOTabs, with a uniquevalueand alabel. - Put the tab's content in the default slot. Add
lazyto mount it only while the tab is selected, orlazy-onceto mount it on the first selection and keep it afterwards.
Example
The rendered example and its source come from the same Vue single-file component.
Content of the overview tab.
Interactive playground
Disable a pane to see keyboard navigation skip its tab.
Content of the overview tab.
Content of the activity tab.
Content of the settings tab.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | undefined | Unique value bound to the parent OTabs v-model when the tab is selected. |
label | string | undefined | Visible text and accessible name of the tab. |
disabled | boolean | false | Prevents selecting the tab and skips it during keyboard navigation. |
lazy | boolean | false | Mounts the content only while the tab is selected, and unmounts it when another tab is selected. |
lazyOnce | boolean | false | Mounts the content the first time the tab is selected, then keeps it mounted and hidden. |
Events
| Event | Payload | Description |
|---|---|---|
| none | none | No custom Vue events are emitted. |
Slots
| Slot | Props | Description |
|---|---|---|
default | none | Content of the panel; without it, the tab has no panel. |
CSS custom properties
| Custom property | Default | Description |
|---|---|---|
| none | none | No component-specific custom properties are exposed. |
Override example
OTabPane has no public CSS custom properties. Style its tab and panel through the OTabs custom properties.
Accessibility
label is the visible text and accessible name of the tab. OTabs renders the tab and its tabpanel, labels the panel by the tab, and links them with aria-controls; disabled uses the native disabled attribute and removes the tab from keyboard navigation.
Behavior and edge cases
OTabPaneonly renders its content;OTabsreads its props to build the tab list, so a pane rendered outsideOTabshas no tab.- By default the content stays mounted and its panel is hidden while another tab is selected, so components keep their local state.
lazyunmounts it when another tab is selected;lazy-oncedefers mounting until the first selection.lazywins when both are set. - A pane without a default slot renders a tab but no panel, for content that lives elsewhere, such as a
RouterView.