Element: <oj-tab-bar>

Oracle® JavaScript Extension Toolkit (JET)
17.1.0

G12196-01

Since:
  • 4.0.0
Module:
  • ojnavigationlist

QuickNav

Attributes


Context Objects

Description: JET Tab Bar enhances a HTML list element into a themable, WAI-ARIA compliant, mobile friendly component with advance interactive features.

Data

The JET Tab Bar gets its data in two different ways. The first way is from a DataProvider/TableDataSource. There are several types of DataProvider/TableDataSource that are available out of the box:

  • oj.ArrayDataProvider
  • oj.CollectionTableDataSource

oj.ArrayDataProvider - Use this when the underlying data is an array object or an observableArray. In the observableArray case, Tab Bar will automatically react when items are added or removed from the array. See the documentation for oj.ArrayDataProvider for more details on the available options.

oj.CollectionTableDataSource - Use this when oj.Collection is the model for the underlying data. Note that the Tab Bar will automatically react to model event from the underlying oj.Collection. See the documentation for oj.CollectionTableDataSource for more details on the available options.

NOTE: PagingTableDataSource is not supported by Tab Bar.

Second way is using static HTML content as data.

Note that any manipulation of static HTML content, including manipulating content generated through Knockout (for example, updating observableArray in a foreach binding), is not supported.

Example of static content


<oj-tab-bar>
 <ul>
  <li><a href="#">Item 1</a></li>
  <li><a href="#">Item 2</a></li>
  <li><a href="#">Item 3</a></li>
 </ul>
</oj-tab-bar>

Key

Key is an identifier which uniquely identifies an item in tabbar.

  • When static html is used, it will be the id attribute of <li>. If no id is specified then component will generate an id and will use it as key.
  • When data source is used, it will be the id attribute of item's data object.

Icons

Sublist icons are inserted automatically. To add other icons to list items, include them in the markup and include the oj-tabbar-item-icon class, as follows:

<oj-tab-bar>
  <ul>
    <li id="foo"><a href="#"><span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24"></span>Foo</a></li>
  </ul>
 </oj-tab-bar>

Touch End User Information

Target Gesture Action
List Item Tap Selects the item.
Press & Hold Display context menu
Overflow Menu button Tap Open menu. Refer menu button touch documentation. Note: This is applicable only for Horizontal Tab Bar when overflow is set to popup.

Keyboard End User Information

Target Key Action
List Item Enter or Space Selects list item.
UpArrow Moves focus to the previous visible list item.
DownArrow Moves focus to the next visible list item
RightArrow (LeftArrow in RTL) For horizontal tab bar,focus will be moved to next visible item.
LeftArrow (RightArrow in RTL) For horizontal tab bar,focus will be moved to previous visible item.
Home Moves focus to the first visible list item.
End Moves focus to the last visible list item.
F2 If focus is on a list item, pressing F2 will make its contents accessible using TAB. It can also be used to exit actionable mode if already in actionable mode.
Esc When F2 mode is enabled, press Esc to exit F2 mode.
Ctrl+X Marks the current item to move if reorderable is enabled.
Ctrl+V Paste the item that are marked to directly before the current item
DELETE Delete the current item.
Overflow Menu button Enter or Space Open menu. Refer menu button touch documentation. Note: This is applicable only for Horizontal Tab Bar when overflow is set to popup.

Item Context

For all item options, developers can specify a function as the return value. The function takes a single argument, which is an object that contains contextual information about the particular item. This gives developers the flexibility to return different value depending on the context.

The context paramter contains the following keys:

Key Description
componentElement oj-tab-bar element.
datasource A reference to the data source object. (Not available for static content)
index The index of the item, where 0 is the index of the first item.
key The Key of the item.
data The data object for the item.
parentElement The list item element. The renderer can use this to directly append content.

Migration

Read about current Core Pack limitations to decide when to migrate.
Please make note of the following:

oj-c-tab-bar will replace oj-tab-bar in core pack.

Migration to oj-c-tab-bar

To migrate from oj-tab-bar to oj-c-tab-bar, you need to revise the import statement and references to oj-c-tab-bar in your app. Please note the changes between the two components below.

These features are not yet available in oj-c-tab-bar, they will be available in a forthcoming version.

  • Progressive Truncation
  • Context Menu Support

The first step is to determine if your tab bar requires any of the not yet released features (see above list).

The next step is to determine compatibility with your DataSource. Here are some changes.

  • DataProvider and array of type TabData are the only currently supported data source
  • itemTemplate is no longer supported

Finally review the list below for specific API changes.

Reorder Behavior Change

Use Command + Shift + Arrow Keys to reorder.

itemTemplate slot

Support for itemTemplate has not been brought forward as oj-c-tab-bar does not support arbitary content.

current-item attribute

This property is not available as it is internal to the component./p>

item.renderer attribute

This is not supported, everything this attribute did can be accomplished using items that will be rendered by the component

item.selectable attribute

This is not supported, everything this attribute did can be accomplished using selectiom attribute

ojBeforeCurrentItem event

this cancellable event is slated for deprecation.

ojBeforeDeselect event

this cancellable event is slated for deprecation.

ojBeforeRemove event

this cancellable event is slated for deprecation.

ojDeselect event

this cancellable event is slated for deprecation.

The following features are not yet supported
  • Progressive Truncation
  • Custom contextMenu support

Performance

Data Set Size

As a rule of thumb, it's recommended that applications limit the amount of data to display. Displaying large number of items in Tab Bar makes it hard for user to find what they are looking for, but affects the load time.

Item Content

Tab Bar allows developers to specify arbitrary content inside its item. In order to minimize any negative effect on performance, you should avoid putting a large number of heavy-weight components inside because as you add more complexity to the structure, the effect will be multiplied because there can be many items in the Tab Bar.

Reading direction

The only supported way to set the reading direction (LTR or RTL) is to set the "dir" attribute on the <html> element of the page. As with any JET custom element, in the unusual case that the reading direction is changed post-init, the tab bar must be refresh()ed, or the page must be reloaded.

Animation

Applications can customize animations triggered by actions in Tab Bar by overriding action specific style classes on the animated item. See the documentation of AnimationUtils class for details.

The following are actions in which applications can use to customize animation effects.

Action Description
horizontal add When a new item is added to the TableDataSource associated with Horizontal Tab Bar.
add When a new item is added to the TableDataSource associated with Vertical Tab Bar.
horizontal remove When an existing item is removed from the TableDataSource associated with Horizontal Tab Bar.
remove When an existing item is removed from the TableDataSource associated with Vertical Tab Bar.
update When an existing item is updated in the TableDataSource associated with TabBar.
pointerUp When user finish pressing an item (on touch).


Usage

Signature:

interface TabBarElement<K, D>

Generic Parameters
ParameterDescription
KType of key of the dataprovider
DType of data from the dataprovider
Typescript Import Format
//To typecheck the element APIs, import as below.
import { TabBarElement } from "ojs/ojnavigationlist";

//For the transpiled javascript to load the element's module, import as below
import "ojs/ojnavigationlist";

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.


Styling Classes

.oj-disabled
Any list item can be disabled by adding the oj-disabled class to that element
Deprecated:
Since Description
16.0.0 Disabled Tab Bar items are not recommended in the Redwood design system, tabs should be removed, not disabled.
Example
<oj-tab-bar>
  <ul>
    <li id="foo" class="oj-disabled" >
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-focus-highlight
Under normal circumstances this class is applied automatically. It is documented here for the rare cases that an app developer needs per-instance control.

The oj-focus-highlight class applies focus styling that may not be desirable when the focus results from pointer interaction (touch or mouse), but which is needed for accessibility when the focus occurs by a non-pointer mechanism, for example keyboard or initial page load.

The application-level behavior for this component is controlled in the theme by the $focusHighlightPolicy SASS variable; however, note that this same variable controls the focus highlight policy of many components and patterns. The values for the variable are:

nonPointer: oj-focus-highlight is applied only when focus is not the result of pointer interaction. Most themes default to this value.
all: oj-focus-highlight is applied regardless of the focus mechanism.
none: oj-focus-highlight is never applied. This behavior is not accessible, and is intended for use when the application wishes to use its own event listener to precisely control when the class is applied (see below). The application must ensure the accessibility of the result.

To change the behavior on a per-instance basis, the application can set the SASS variable as desired and then use event listeners to toggle this class as needed.
Example
<oj-tab-bar class="oj-focus-highlight">
  <!-- Content -->
</oj-tab-bar>
.oj-removable
Use this class to make an item removable.
Example
<oj-tab-bar>
  <ul>
    <li id="foo" class="oj-removable" >
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-category-divider
Use this class to add a horizontal divider line between two categories of items.
Example
<oj-tab-bar>
  <ul>
    <li ...></li>
    <li class="oj-tabbar-category-divider"></li>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-hide-remove-icon
Use this class to hide the remove icon. In this case, Item can be removed using context menu.
Example
<oj-tab-bar class="oj-tabbar-hide-remove-icon" >
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-item-dividers

Note: This styleclass is not supported in the following themes: Redwood

Use this class to render a divider between tab items. Note: On IE11, this is not supported when overflow attribute is set to 'popup'.
Example
<oj-tab-bar class="oj-tabbar-item-dividers">
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-item-end

Note: This styleclass is not supported in the following themes: Alta

Use this class to add an badge/metadata/icon to a list item.
Example
<oj-tab-bar class="oj-tabbar-item-end" >
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-end>
           <span class="oj-badge oj-badge-subtle">3
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-item-icon
Use this class to add an icon to a list item.
Example
<oj-tab-bar class="oj-tabbar-stack-icon-label" >
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-item-label
Use this class to specify the element with the label. This will eliminate the need for Tabbar to automatically wrap any child element that is not an icon or a badge with this class. Note the content must have the correct order (icon element first, then the label element, then the badge element) as Tabbar in this case will not attempt to reorder the content.
Example
<oj-tab-bar class="oj-tabbar-stack-icon-label" >
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        <span class="oj-tabbar-item-label">
        Foo
        </span>
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-item-text-wrap
Use this class to wrap item label text. Note: On IE11, this is not supported when overflow attribute is set to 'popup'. This style class is not supported when edge is 'top' or 'bottom'.
Deprecated:
Since Description
15.0.0 Since vertical layout of TabBar is deprecated, this should not be used anymore. Use NavigationList instead.
Example
<oj-tab-bar class="oj-tabbar-item-text-wrap" >
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-item-title
When arbitrary content is placed inside an item's content area, its title text can be marked using this style class. This helps the component in identifying the Item's label.
Example
<li id="foo">
  <div>
    <span class="oj-tabbar-item-title">Play</span>
      <button>Button</button>
  </div>
</li>
Use this class to prevent automatic navigation to the url specified on an <a> tag's href attribute.
In this case, navigation can be handled programmatically by using selectionChanged event.
This is useful to execute some custom logic before browser triggers navigation.
Example
<oj-tab-bar class="oj-tabbar-nofollow-link" >
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>
.oj-tabbar-stack-icon-label
Use this class to display a horizontal Tab Bar with icons and labels stacked. Applicable only when edge is top.
Deprecated:
Since Description
9.0.0 Use display attribute instead.
Example
<oj-tab-bar class="oj-tabbar-stack-icon-label" >
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>

Category: Condense

Use this class to wrap item label text. Note: On IE11, this is not supported when overflow attribute is set to 'popup'.

Class template:

.oj-[size]-condense

Note: Square brackets signify required token substitutions whereas parentheses signify optional token substitutions.

Values for [size]

Value (required) Name Description
sm Small Small screen size range
md Medium Medium screen size range
lg Large Large screen size range
xl X-Large Extra large screen size and up

Example
<oj-tab-bar class="oj-sm-condense" >
  <ul>
    <li id="foo">
      <a href="#">
        <span class="oj-tabbar-item-icon demo-icon-font-24 demo-palette-icon-24">
        </span>
        Foo
      </a>
    </li>
  </ul>
</oj-tab-bar>

CSS Variables

See JET CSS Variables for additional details.
Name Type Description
--oj-tab-bar-icon-to-text-padding <length> Padding between icon and text
--oj-tab-bar-icon-margin <length> Tab bar icon margin
--oj-tab-bar-icon-size <length> Tab bar icon size
--oj-tab-bar-item-margin <length> Tab bar item margin
--oj-tab-bar-item-padding <length> Tab bar item padding
--oj-tab-bar-item-min-height <length> Tab bar item minimum height
--oj-tab-bar-item-line-height <number> Tab bar item line height
--oj-tab-bar-item-font-size <length> Tab bar item font size
Default
Name Type Description
--oj-tab-bar-item-font-weight <font_weight> Default tab bar item font weight
--oj-tab-bar-item-label-color <color> Default tab bar item label color
Hovered
Name Type Description
--oj-tab-bar-item-label-color-hover <color> Tab bar item label color when hovered
--oj-tab-bar-item-bg-color-hover <color> Tab bar item background color when hovered
Active
Name Type Description
--oj-tab-bar-item-bg-color-active <color> Tab bar item background color when active
--oj-tab-bar-item-border-color-active <color> Tab bar item border color when active
Selected
Name Type Description
--oj-tab-bar-item-font-weight-selected <font_weight> Tab bar item font weight when selected
--oj-tab-bar-item-label-color-selected <color> Tab bar item label color when selected
--oj-tab-bar-item-bg-color-selected <color> Tab bar item background color when selected
--oj-tab-bar-item-border-color-selected <color> Tab bar item border color when selected

Slots

JET components that allow child content support slots. Please see the slots section of the JET component overview doc for more information on allowed slot content and slot types.

contextMenu

The contextMenu slot is set on the oj-menu within this element. This is used to designate the JET Menu that this component should launch as a context menu on right-click, Shift-F10, Press & Hold, or component-specific gesture. If specified, the browser's native context menu will be replaced by the JET Menu specified in this slot.

The application can register a listener for the Menu's ojBeforeOpen event. The listener can cancel the launch via event.preventDefault(), or it can customize the menu contents by editing the menu DOM directly, and then calling refresh() on the Menu.

To help determine whether it's appropriate to cancel the launch or customize the menu, the ojBeforeOpen listener can use component API's to determine which table cell, chart item, etc., is the target of the context menu. See the JSDoc of the individual components for details.

Keep in mind that any such logic must work whether the context menu was launched via right-click, Shift-F10, Press & Hold, or component-specific touch gesture.

itemTemplate

The itemTemplate slot is used to specify the template for rendering each item in the list. The slot content must be a <template> element. The content of the template could either include the <li> element, in which case that will be used as the root of the item. Or it can be just the content which excludes the <li> element.

When the template is executed for each item, it will have access to the binding context containing the following properties:

  • $current - an object that contains information for the current item. (See oj.ojTabBar.ItemTemplateContext or the table below for a list of properties available on $current)
  • alias - if as attribute was specified, the value will be used to provide an application-named alias for $current.
Properties of $current:
Name Type Description
componentElement Element The <oj-tab-bar> custom element
data Object The data for the current item being rendered
index number The zero-based index of the current item
key any The key of the current item being rendered

Attributes

as :string

An alias for the current item when referenced inside the item template. This can be especially useful if oj-bind-for-each element is used inside the item template since it has its own scope of data access.
Deprecated:
Since Description
6.2.0 Set the alias directly on the template element using the data-oj-as attribute instead.
Default Value:
  • ''
Names
Item Name
Property as
Property change event asChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-as-changed

current-item :any

Key of the current item. Current item is the list item which is having active focus. Note that if currentItem is set to an item that is currently not available (not fetched or inside a collapsed parent node), then the value is ignored.

When the current item is changed, the event.detail of the currentItemChanged event will contain the following additional properties:

Name Type Description
item Element Current Item element
Default Value:
  • null
Supports writeback:
  • true
Names
Item Name
Property currentItem
Property change event currentItemChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-current-item-changed

data :(TableDataSource|DataProvider|null) data :(DataProvider.<K, D>|null)

The data source for the Tab Bar accepts either a TableDataSource or DataProvider. See the data source section in the introduction for out of the box data source types. If the data attribute is not specified, the child elements are used as content. If there's no content specified, then an empty list is rendered.
Default Value:
  • null
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 :"all"|"icons"|"stacked"

Whether to display both the label and icons ("all") or just the icons ("icons"). In the latter case, the label is displayed in a tooltip instead, unless a tooltip was already supplied at create time. Note: If display="icons" is used with oj-tabbar-item-end then it is supoorted only for badge and not for icon or metadata. If display="stacked" is used with oj-tabbar-item-end then it is supoorted only for badge and not for icon or metadata. It is also mandatory to provide icons for each item as stated in icons section.
Supported Values:
Value Description
all Display both the label and icons.
icons Display only the icons.
stacked Display icons with stacked label.
Default Value:
  • all
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"|"start"|"end" edge :"top"|"bottom"|"start"

The position of the Tab Bar. Valid Values: top and bottom.
Supported Values:
Value Description
bottom This renders list items horizontally. Generally used when tab bar placed on bottom of content section.
end This renders list items vertically. Generally used when tab bar placed on right/end of content section.
Deprecated:
Since Description
15.0.0 Use NavigationList instead.
start This renders list items vertically. Generally used when tab bar placed on left/start of content section.
top This renders list items horizontally. Generally used when tab bar placed on top of content section.
Default Value:
  • start
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

item :Object

The item property contains a subset of properties for items.
Names
Item Name
Property item
Property change event itemChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-item-changed

(nullable) item.renderer :(((context: ojTabBar.ItemContext<K, D>) => void)|null)

The renderer function that renders the content of the item. See itemContext in the introduction to see the object passed into the renderer function. The function should return one of the following:
  • An Object with the following property:
    • insert: HTMLElement | string - A string or a DOM element of the content inside the item.
  • undefined: If the developer chooses to manipulate the item element directly, the function should return undefined.
If no renderer is specified, Tab Bar will treat the data as a String.
Default Value:
  • null
Names
Item Name
Property item.renderer

(nullable) item.selectable :(((context: ojTabBar.ItemContext<K, D>) => boolean)|boolean)

Whether the item is selectable. See itemContext in the introduction to see the object passed into the selectable function.
Default Value:
  • true
Names
Item Name
Property item.selectable

layout :"stretch"|"condense"

Whether to stretch the tab bar items to occupy available space or to condense items
Supported Values:
Value Description
condense all items are condense
stretch all items are stretched
Default Value:
  • stretch
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 :"popup"|"hidden"

Specifies the overflow behaviour. NOTE: This is only applicable when edge attribute set to top
Supported Values:
Value Description
hidden Overflow is clipped, and the rest of the content will be invisible.
popup Popup menu will be shown with overflowed items.

Note that setting overflow to popup can trigger browser reflow, so only set it when it is actually required.

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 by drag-and-drop.
Supported Values:
Value Description
disabled Disables reordering of items in tabbar.
enabled Enables reordering of items in tabbar.
Default Value:
  • disabled
Since:
  • 4.1.0
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 :any

Item Key of currently selected list item. If the value is modified by an application, tab bar UI is modified to match the new value and the event.detail of the selectionChanged event will contain the following additional properties:

Name Type Description
item Element Selected Item element
Default Value:
  • null
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

translations :object|null

A collection of translated resources from the translation bundle, or null if this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.

If the component does not contain any translatable resource, the default value of this attribute will be null. If not, an object containing all resources relevant to the component.

If this component has translations, their documentation immediately follows this doc entry.

Names
Item Name
Property translations
Property change event translationsChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-translations-changed

translations.accessible-reorder-after-item :string

Provides properties to customize the screen reader text when the tentative drop target is after a certain item.

Default Value:
  • "After {item}"
Since:
  • 4.1.0
Names
Item Name
Property translations.accessibleReorderAfterItem

translations.accessible-reorder-before-item :string

Provides properties to customize the screen reader text when the tentative drop target is before a certain item.

Default Value:
  • "Before {item}"
Since:
  • 4.1.0
Names
Item Name
Property translations.accessibleReorderBeforeItem

translations.accessible-reorder-touch-instruction-text :string

Provides properties to customize the screen reader touch instructional text for reordering items.

Default Value:
  • "Double tap and hold. Wait for the sound then drag to rearrange."
Since:
  • 4.1.0
Names
Item Name
Property translations.accessibleReorderTouchInstructionText

translations.label-cut :string

Provides properties to customize the context menu cut label.

See the translations attribute for usage examples.

Default Value:
  • "Cut"
Since:
  • 4.1.0
Names
Item Name
Property translations.labelCut

translations.label-paste-after :string

Provides properties to customize the context menu paste after label.

See the translations attribute for usage examples.

Default Value:
  • "Paste After"
Since:
  • 4.1.0
Names
Item Name
Property translations.labelPasteAfter

translations.label-paste-before :string

Provides properties to customize the context menu paste before label.

See the translations attribute for usage examples.

Default Value:
  • "Paste Before"
Since:
  • 4.1.0
Names
Item Name
Property translations.labelPasteBefore

translations.label-remove :string

Provides properties to customize the context menu remove label.

See the translations attribute for usage examples.

Default Value:
  • "Remove"
Since:
  • 4.1.0
Names
Item Name
Property translations.labelRemove

(nullable) translations.msg-fetching-data :string

Provides properties to customize the message text used by Tab Bar when waiting for data.

See the translations attribute for usage examples.

Default Value:
  • "Fetching Data..."
Since:
  • 4.0.0
Names
Item Name
Property translations.msgFetchingData

(nullable) translations.msg-no-data :string

Provides properties to customize the message text used by Tab Bar when there are no items.

See the translations attribute for usage examples.

Deprecated:
Since Description
17.0.0 This option has been deprecate. We will no long have the message when no data.
Default Value:
  • ""
Names
Item Name
Property translations.msgNoData

(nullable) translations.overflow-item-label :string

Label for overflow menu button.

See the translations attribute for usage examples.

Default Value:
  • "More"
Since:
  • 4.0.0
Names
Item Name
Property translations.overflowItemLabel

translations.remove-cue-text :string

Text cue for the removable tab, used as the aria-label for the close icon.

Default Value:
  • "Removable"
Since:
  • 4.1.0
Names
Item Name
Property translations.removeCueText

(nullable) translations.selected-label :string

Provides text to read to screen reader when an item is selected.

See the translations attribute for usage examples.

Default Value:
  • "selected"
Since:
  • 4.0.0
Names
Item Name
Property translations.selectedLabel

truncation :"none"|"progressive"

Truncation applies to the tab titles when there is not enough room to display all tabs.
Supported Values:
Value Description
none tabs always take up the space needed by the title texts.
progressive If not enough space is available to display all of the tabs, then the width of each tab title is restricted just enough to allow all tabs to fit. All tab titles that are truncated are displayed with ellipses. However the width of each tab title will not be truncated below a specific threshold defined by the theme.
Default Value:
  • none
Since:
  • 4.1.0
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

Context Objects

Each context object contains, at minimum, a subId property, whose value is a string that identifies a particular DOM node in this element. It can have additional properties to further specify the desired node. See getContextByNode for more details.

Properties:
Name Type Description
subId string Sub-id string to identify a particular dom node.

Following are the valid subIds:

oj-tabbar-item

Context for the oj-tab-bar component's items.

Properties:
Name Type Description
index number the zero based item index
key Object | string the Key of the item

Events

ojAnimateEnd

Triggered when the default animation of a particular action has ended. Note this event will not be triggered if application cancelled the default animation on animateStart.
Deprecated:
Since Description
12.1.0 This web component no longer supports this event.
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
action string the action that triggered the animation.

See animation section for a list of actions.
element Element the target of animation.

ojAnimateStart

Triggered when the default animation of a particular action is about to start. The default animation can be cancelled by calling event.preventDefault.
Deprecated:
Since Description
12.1.0 This web component no longer supports this event.
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
action string the action that triggers the animation.

See animation section for a list of actions.
element Element the target of animation.
endCallback function():void if the event listener calls event.preventDefault to cancel the default animation, it must call the endCallback function when it finishes its own animation handling and when any custom animation ends.

ojBeforeCurrentItem

Triggered before the current item is changed via the currentItem property or via the UI. To prevent the item being focused, invoke event.preventDefault().
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
item Element the new current item
key any the Key of the new current item
previousItem Element the previous item
previousKey any the Key of the previous item

ojBeforeDeselect

Triggered immediately before a tab is deselected. To prevent the item being deselected, invoke event.preventDefault().
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
fromItem Element the tab item being navigated from
fromKey any the Key of the tab item being navigated from
toItem Element the tab item being navigated to
toKey any the Key of the tab item being navigated to
Since:
  • 4.1.0

ojBeforeRemove

Triggered before the item is removed via the UI. To prevent the item being removed, invoke event.preventDefault().
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
item Element Item being removed
key any Key of the item being removed
Since:
  • 4.1.0

ojBeforeSelect

Triggered before this list item is selected. To prevent the item selection, invoke event.preventDefault().

Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
item Element Selected list item.
key any Selected list item Key.

ojDeselect

Triggered after a tab has been deselected.
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
fromItem Element the tab item being navigated from
fromKey any the Key of the tab item being navigated from
toItem Element the tab item being navigated to
toKey any the Key of the tab item being navigated to
Since:
  • 4.1.0

ojRemove

Triggered immediately after a tab is removed. This should be used to remove item from dom or from data source.
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
item Element Item removed
key any Key of the item removed
Since:
  • 4.1.0

ojReorder

Triggered after reordering items within tabbar via drag and drop or cut and paste. This should be used to reorder item in dom or data source.
Properties:

All of the event payloads listed below can be found under event.detail. See Events and Listeners for additional information.

Name Type Description
item Element Item to be moved
position 'before' | 'after' the drop position relative to the reference item. Possible values are "before" and "after".
reference Element the item where the moved items are drop on.
Since:
  • 4.1.0

Methods

getContextByNode(node) : {(oj.ojTabBar.NodeContext.<K>|null)}

Returns an object with context for the given child DOM node. This will always contain the subid for the node, defined as the 'subId' property on the context object. Additional component specific information may also be included. For more details on returned objects, see context objects.
Parameters:
Name Type Argument Description
node Element <not nullable>
The child DOM node
Returns:

The context for the DOM node, or null when none is found.

Type
(oj.ojTabBar.NodeContext.<K>|null)

getProperty(property) : {any}

Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
Parameters:
Name Type Description
property string The property name to get. Supports dot notation for subproperty access.
Since:
  • 4.0.0
Returns:
Type
any
Example

Get a single subproperty of a complex property:

let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2');

refresh : {void}

Refreshes the visual state of the Tab Bar. JET components require a refresh() after the DOM is programmatically changed underneath the component.

This method does not accept any arguments.

Returns:
Type
void

setProperties(properties) : {void}

Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
Parameters:
Name Type Description
properties Object An object containing the property and value pairs to set.
Since:
  • 4.0.0
Returns:
Type
void
Example

Set a batch of properties:

myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"});

setProperty(property, value) : {void}

Sets a property or a subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
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.
Since:
  • 4.0.0
Returns:
Type
void
Example

Set a single subproperty of a complex property:

myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");

Type Definitions

ItemContext<K, D>

Properties:
Name Type Argument Description
componentElement Element oj-tab-bar element
data D The data object for the item.
datasource DataProvider.<K, D> <optional>
A reference to the data source object. (Not available for static content)
index number The index of the item, where 0 is the index of the first item.
key K The Key of the item.
parentElement Element The list item element. The renderer can use this to directly append content.

ItemTemplateContext

Properties:
Name Type Description
componentElement Element The <oj-tab-bar> custom element
data Object The data for the current item being rendered
index number The zero-based index of the current item
key any The key of the current item being rendered

NodeContext<K>

Properties:
Name Type Description
index number The index of the item, where 0 is the index of the first item.
key K The Key of the item.
subId string Sub-id string to identify a particular dom node.