TabStrip

A row or column of tab buttons, typically as part of a Tabs or similar component. It is responsible for positioning the tab buttons, handling keyboard navigation, and supporting accessibility.

A generic instance of TabStrip that uses plain <button> instances for tab buttons might look like this:

Demo: Generic TabStrip with plain buttons

The LabeledTabs component uses TabStrip internally to position its buttons:

Page one
Page two
Page three

Show tabs on:     Align tabs:

Demo: LabeledTabs uses TabStrip interally

TabStrip assigns a default ARIA role of tab to each button.

The TabStrip class is registered as element <elix-tab-strip>.

API

can-select-next-changed event

Fires when the canSelectNext property changes in response to internal component activity.

Defined by SingleSelectionMixin

can-select-previous-changed event

Fires when the canSelectPrevious property changes in response to internal component activity.

Defined by SingleSelectionMixin

canSelectNext property

True if the selection can be moved to the next item, false if not (the selected item is the last item in the list).

Type: boolean

Defined by SingleSelectionMixin

canSelectPrevious property

True if the selection can be moved to the previous item, false if not (the selected item is the first one in the list).

Type: boolean

Defined by SingleSelectionMixin

reflectAttribute(attribute, value) method

Set/unset the attribute with the indicated name.

This method exists primarily to handle the case where an element wants to set a default property value that should be reflected as an attribute. An important limitation of custom element consturctors is that they cannot set attributes. A call to reflectAttribute during the constructor will be deferred until the element is connected to the document.

Parameters:
  • attribute: stringThe name of the *attribute* (not property) to set.
  • value: objectThe value to set. If null, the attribute will be removed.

Defined by AttributeMarshallingMixin

reflectClass(className, value) method

Set/unset the class with the indicated name.

This method exists primarily to handle the case where an element wants to set a default property value that should be reflected as as class. An important limitation of custom element consturctors is that they cannot set attributes, including the class attribute. A call to reflectClass during the constructor will be deferred until the element is connected to the document.

Parameters:
  • className: stringThe name of the class to set.
  • value: objectTrue to set the class, false to remove it.

Defined by AttributeMarshallingMixin

selected-index-changed event

Fires when the selectedIndex property changes in response to internal component activity.

Defined by SingleSelectionMixin

selected-item-changed event

Fires when the selectedItem property changes in response to internal component activity.

Defined by SingleSelectionMixin

selectedIndex property

The index of the item which is currently selected.

The setter expects an integer or a string representing an integer.

A selectedIndex of -1 indicates there is no selection. Setting this property to -1 will remove any existing selection.

Type: number

Defined by SingleSelectionMixin

selectedItem property

The currently selected item, or null if there is no selection.

Setting this property to null deselects any currently-selected item. Setting this property to an object that is not in the list has no effect.

Type: object

Defined by SingleSelectionMixin

selectFirst() method

Select the first item in the list.

Returns: Boolean True if the selection changed, false if not.

Defined by SingleSelectionMixin

selectionRequired property

True if the list should always have a selection (if it has items).

Type: boolean

Default: false

Defined by SingleSelectionMixin

selectionWraps property

True if selection navigations wrap from last to first, and vice versa.

Type: boolean

Default: false

Defined by SingleSelectionMixin

selectLast() method

Select the last item in the list.

Returns: Boolean True if the selection changed, false if not.

Defined by SingleSelectionMixin

selectNext() method

Select the next item in the list.

If the list has no selection, the first item will be selected.

Returns: Boolean True if the selection changed, false if not.

Defined by SingleSelectionMixin

selectPrevious() method

Select the previous item in the list.

If the list has no selection, the last item will be selected.

Returns: Boolean True if the selection changed, false if not.

Defined by SingleSelectionMixin

symbols.goDown() method

Invoked when the user wants to go/navigate down. The default implementation of this method does nothing.

Defined by KeyboardDirectionMixin

symbols.goEnd() method

Invoked when the user wants to go/navigate to the end (e.g., of a list). The default implementation of this method does nothing.

Defined by KeyboardDirectionMixin

symbols.goLeft() method

Invoked when the user wants to go/navigate left. The default implementation of this method does nothing.

Defined by KeyboardDirectionMixin

symbols.goRight() method

Invoked when the user wants to go/navigate right. The default implementation of this method does nothing.

Defined by KeyboardDirectionMixin

symbols.goStart() method

Invoked when the user wants to go/navigate to the start (e.g., of a list). The default implementation of this method does nothing.

Defined by KeyboardDirectionMixin

symbols.goUp() method

Invoked when the user wants to go/navigate up. The default implementation of this method does nothing.

Defined by KeyboardDirectionMixin

symbols.itemAdded(item) method

Handle a new item being added to the list.

The default implementation of this method simply sets the item's selection state to false.

Parameters:
  • item: HTMLElementthe item being added

Defined by SingleSelectionMixin

symbols.itemSelected(item, selected) method

Apply the indicate selection state to the item.

The default implementation of this method does nothing. User-visible effects will typically be handled by other mixins.

Parameters:
  • item: HTMLElementthe item being selected/deselected
  • selected: booleantrue if the item is selected, false if not

Defined by SingleSelectionMixin

symbols.keydown(event) method

Handle the indicated keyboard event.

The default implementation of this method does nothing. This will typically be handled by other mixins.

Returns: boolean true if the event was handled

Parameters:
  • event: KeyboardEventthe keyboard event

Defined by KeyboardMixin

tabPosition property

The position of the tab strip relative to the element's children. Valid values are "top", "left", "right", and "bottom".

Type: string

Default: "top"

© 2016-2017 Component Kitchen Inc. and contributors to the Elix project. ELIX and the Elix project logo are registered or unregistered trademarks of Component Kitchen Inc. in the United States and/or other countries. Other trademarks are the property of their respective owners. Any use of such trademarks without written permission sought and obtained from Component Kitchen is prohibited.

The Elix project is administered, as a courtesy, by Component Kitchen for the benefit of the project’s contributors and the developer community as a whole.