Usage
Signature:
interface CTabBarElement<K extends string | number = string | number>
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CTabBarElement } from "oj-c/tab-bar";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/tab-bar";
For additional information visit:
Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Attributes
-
context-menu-config :oj-c.TabBar.CTabBarContextMenuConfig.<K>
-
Specifies a context menu configuration. It takes the keys `accessibleLabel` and `items`, where `accessibleLabel` is optional and items required . `items` function returns an array of menu item object representations that indicates what menu items are going to be part of menu based on some specific context menu context.
Context Menu Item Type Def ContextMenuSeparator { type: 'separator'} MenuItem { type?: 'item'; label: string; key: string; disabled?: boolean; onAction?: () => void; startIcon?: MenuIcon; endIcon?: MenuIcon; variant?: 'standard' | 'destructive'; }; ContextMenuSubMenu { type: 'submenu'; label?: string; disabled?: boolean; startIcon?: string; items?: Array<ContextMenuItems>; }; ContextMenuSelectSingle { type: 'selectsingle'; key?: string; items?: Array<MenuSelectItem>; selection?: string; onSelection?: (detail: { value: string }) => void; }; ContextMenuSelectMultiple { type: 'selectmultiple'; key?: string; items?: Array<MenuSelectItem>; selection?: Array<string>; onSelection?: (detail: { value: Array<string> }) => void; }; MenuIcon { type?: 'class'; class: string; } | { type: 'img'; src: string; }; MenuSelectItem { label: string; disabled?: boolean; endIcon?: MenuIcon; value: string; } Names
Item Name Property contextMenuConfig
Property change event contextMenuConfigChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-context-menu-config-changed
-
data :(Array.<(oj-c.TabBar.TabData.<K>|oj-c.TabBar.TabLinkItemData.<K>)>|DataProvider.<K, (oj-c.TabBar.TabData.<K>|oj-c.TabBar.TabLinkItemData.<K>)>)
-
Specifies the data definitions for the tabs.
- Default Value:
[]
Names
Item Name Property data
Property change event dataChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-data-changed
-
display :"standard"|"icons"|"stacked"
-
Whether to display both the label and icons ("standard") or just the icons ("icons") or to render stacked display ("stacked"). In the latter case, the label is displayed in a tooltip instead.
- Default Value:
"standard"
Supported Values:
Value Description icons
Only icons are shown for all tabs. stacked
Stacks the badge over the icon and icon over the label when applicable. standard
Label and icon are shown for all tabs. Names
Item Name Property display
Property change event displayChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-display-changed
-
edge :"top"|"bottom"
-
The position of the TabBar.
- Default Value:
"top"
Names
Item Name Property edge
Property change event edgeChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-edge-changed
-
layout :"stretch"|"condense"
-
Whether to stretch the tab bar items to occupy available space or to condense items
- Default Value:
"stretch"
Supported Values:
Value Description condense
Condenses the space occupied by tab bar items stretch
Stretches the tab bar items to occupy available space Names
Item Name Property layout
Property change event layoutChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-layout-changed
-
overflow :"hidden"|"popup"|"conveyor"
-
Specifies the overflow behavior
- Default Value:
"hidden"
Names
Item Name Property overflow
Property change event overflowChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-overflow-changed
-
reorderable :"enabled"|"disabled"
-
Specifies if the tabs can be reordered within the tab bar. Note: Do not use with
overflow="popup"
as reorder is not supported with popup.- Default Value:
"disabled"
Supported Values:
Value Description disabled
Disables reordering of items in tabbar. enabled
Enables reordering of items in tabbar. Names
Item Name Property reorderable
Property change event reorderableChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-reorderable-changed
-
selection :K
-
The key of the currently selected tab.
- Supports writeback:
true
Names
Item Name Property selection
Property change event selectionChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-selection-changed
-
truncation :"none"|"progressive"
-
Truncation applies to the tab labels when there is not enough room to display all tabs.
- Default Value:
"none"
Names
Item Name Property truncation
Property change event truncationChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-truncation-changed
Events
-
ojBeforeSelect
-
Triggered before user selects a tab which includes user gestures or selection is changed programmatically.
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description accept
function This method can be called with an application-created Promise to cancel this event asynchronously. The Promise should be resolved or rejected to accept or cancel the event, respectively. key
K -
ojRemove
-
Triggered when user performs a remove gesture on a tab. The remove gestures include:
- User clicks the remove icon in a tab
- User presses Delete key on a tab
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type key
K -
ojReorder
-
Triggered when user performs a reorder gesture on a tab. The reorder gestures include:
- User drags a tab and drops it in a new drop location
- User presses Command + Shift + Arrow key(s) on a tab
overflow="popup"
as reorder is not supported with popup.Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type Description reorderedKeys
Array<K> The new order of keys after reorder -
ojSelectionAction
-
Triggered when user performs a selection action gesture on a tab. The action gestures include:
- User clicks anywhere in a tab
- User taps anywhere in a tab
- User pressed spacebar or enter key on a tab
Properties:
All of the event payloads listed below can be found under
event.detail
. See Events and Listeners for additional information.Name Type previousValue
K value
K
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description property
string The property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
-
setProperties(properties) : {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description properties
object An object containing the property and value pairs to set. Returns:
- Type
- void
-
setProperty(property, value) : {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a corresponding event.
Parameters:
Name Type Description property
string The property name to set. Supports dot notation for subproperty access. value
any The new value to set the property to. Returns:
- Type
- void
Type Definitions
Exported Types
Note: Type definitions in this section are exported by the module, and so can be imported for use in application code.
-
TabData<K extends string | number>
-
The data item object that represents a tab.
Typescript Import Format
//To import this type, use the format below.
import { TabData } from "oj-c/tab-bar";
Properties:
Name Type Argument Description badge
number <optional>
The content to be rendered inside the Badge component. icon
{ type?: 'class'; class: string; } | { type: 'img'; src: string; } <optional>
The icon before the label in non-stack case, icon above the label in stacked case or the stand alone icon when no label is specified. isRemovable
boolean <optional>
Renders a remove icon allowing the tabs to be removed. itemKey
K Key of the TabBarItem label
string Label of the TabBarItem. For icon only display this label is the content for aria-label and tooltip text of the Tab. metadata
string <optional>
The content to be rendered inside the Text component as a metadata, that appears after the label in non stack case only. severity
"none" | "error" | "confirmation" | "info" | "warning" <optional>
The status icon to be rendered after the label in non stack case only. tabPanelId
string <optional>
Accepts the tabpanel element's ID associated with the tab item -
TabLinkItemData<K extends string | number>
-
The data item object that represents a tab with link.
Typescript Import Format
//To import this type, use the format below.
import { TabLinkItemData } from "oj-c/tab-bar";
Properties:
Name Type Argument Description badge
number <optional>
The content to be rendered inside the Badge component. href
string Sets the URL that the hyperlink points to. If there is no valid URL use "#" for href value to navigate to the top of the page. icon
{ type?: 'class'; class: string; } | { type: 'img'; src: string; } <optional>
The icon before the label in non-stack case, icon above the label in stacked case or the stand alone icon when no label is specified. itemKey
K Key of the TabBarItem label
string Label of the TabBarItem. For icon only display this label is the content for aria-label and tooltip text of the Tab. metadata
string <optional>
The content to be rendered inside the Text component as a metadata, that appears after the label in non stack case only. severity
"none" | "error" | "confirmation" | "info" | "warning" <optional>
The status icon to be rendered after the label in non stack case only. tabPanelId
string <optional>
Accepts the tabpanel element's ID associated with the tab item
Documentation-only Types
Note: Type definitions in this section have been provided for documentation purposes and cannot be imported into application code.
-
ContextMenuSelectMultiple
-
Properties:
Name Type Argument Description items
Array.<oj-c.TabBar.MenuSelectItem> <optional>
Specifies the array of select items that make up the select multiple. key
string A unique key associated with the select multiple. onSelection
(detail: oj-c.TabBar.SelectMenuItemDetail<string[]>) => void <optional>
selection
Array<string> <optional>
type
"selectmultiple" Specifies a select multiple menu item. -
ContextMenuSelectSingle
-
Properties:
Name Type Argument Description items
Array.<oj-c.TabBar.MenuSelectItem> <optional>
Specifies the array of select items that make up the select single. key
string A unique key associated with the select single. onSelection
(detail: oj-c.TabBar.SelectMenuItemDetail<string>) => void <optional>
selection
string <optional>
type
"selectsingle" Specifies a select single menu item. -
ContextMenuSeparator
-
Properties:
Name Type type
"separator" -
ContextMenuSubMenu
-
Properties:
Name Type Argument Description disabled
boolean <optional>
Specifies if the submenu is disabled (enabled by default). items
Array<string | oj-c.TabBar.MenuItem | oj-c.TabBar.ContextMenuSeparator | oj-c.TabBar.ContextMenuSubMenu | oj-c.TabBar.ContextMenuSelectSingle | oj-c.TabBar.ContextMenuSelectMultiple> <optional>
key
string <optional>
A unique key associated with the submenu menu item. label
string <optional>
The submenu label. startIcon
string <optional>
Optional icon to render at the start of the submenu. type
"submenu" Specifies a submenu menu item. -
CTabBarContextMenuConfig<K>
-
Properties:
Name Type Argument accessibleLabel
string <optional>
items
(context: oj-c.TabBar.CTabBarItemContextMenuContext<K>) => ("remove" | ContextMenuItems | "defaultMenuItems" | "reorder")[] -
CTabBarItemContextMenuContext<K>
-
Properties:
Name Type hasDefaultMenuItems
boolean itemKey
K -
MenuItem
-
Specifies a standard menu item.
Properties:
Name Type Argument Description disabled
boolean <optional>
Specifies if the menu item is disabled (enabled by default). endIcon
{ type?: 'class'; class: string; } | { type: 'img'; src: string; } <optional>
Optional icon to render at the end of the menu item. key
string A unique key associated with the menu item. label
string The menu item label. onAction
function <optional>
Optional callback function associated with the menu item. startIcon
{ type?: 'class'; class: string; } | { type: 'img'; src: string; } <optional>
Optional icon to render at the start of the menu item. type
"item" <optional>
Specifies a standard menu item. variant
"standard" | "destructive" <optional>
Specifies the menu item behavior. -
MenuSelection
-
Properties:
Name Type Description at
(index: number) => string | undefined Takes an integer value and returns the item at that index, allowing for positive and negative integers. Negative integers count back from the last item in the array. -
MenuSelectItem
-
Specifies a selectable item in a menu item.
Properties:
Name Type Argument Description disabled
boolean <optional>
Specifies if the selectable item is disabled (enabled by default). endIcon
{ type?: 'class'; class: string; } | { type: 'img'; src: string; } <optional>
Optional icon to render at the end of the selectable item. label
string The selectable item label. value
string The value associated with the selectable item. -
SelectMenuItemDetail<T extends oj-c.TabBar.MenuSelection>
-
Properties:
Name Type menuSelectionGroupKey
string value
T