Home

# Class goog.ui.TabBar

Tab bar UI component. A tab bar contains tabs, rendered above, below, before, or after tab contents. Tabs in tab bars dispatch the following events:

- {@link goog.ui.Component.EventType.ACTION} when activated via the keyboard or the mouse,
- {@link goog.ui.Component.EventType.SELECT} when selected, and
- {@link goog.ui.Component.EventType.UNSELECT} when deselected.

Clients may listen for all of the above events on the tab bar itself, and refer to the event target to identify the tab that dispatched the event. When an unselected tab is clicked for the first time, it dispatches both a {@code SELECT} event and an {@code ACTION} event; subsequent clicks on an already selected tab only result in {@code ACTION} events.extends goog.ui.Container

Instance Method Summary
| `deselectIfSelected(?goog.ui.Control tab)` If the specified tab is the currently selected tab, deselects it, and selects the closest selectable tab in the tab bar (first looking before, then after the deselected tab). Does nothing if the argument is not the currently selected tab. Called internally when a tab is removed, hidden, or disabled, to ensure that another tab is selected instead.
| `disposeInternal()` Disposes of the component. Calls {@code exitDocument}, which is expected to remove event handlers and clean up the component. Propagates the call to the component's children, if any. Removes the component's DOM from the document unless it was decorated.
| `enterDocument()` Configures the container after its DOM has been rendered, and sets up event handling. Overrides {@link goog.ui.Component#enterDocument}.
| `getLocation() ⇒ ?goog.ui.TabBar.Location`
| `getSelectedTab() ⇒ ?goog.ui.Control`
| `getSelectedTabIndex() ⇒ number`
| `handleFocus(?goog.events.BrowserEvent e)` Handles focus events dispatched by the tab bar's key event target. If no tab is currently highlighted, highlights the selected tab or the first tab if no tab is selected either.
| `handleTabDisable(?goog.events.Event e)` Handles {@code DISABLE} events displayed by tabs.
| `handleTabHide(?goog.events.Event e)` Handles {@code HIDE} events displayed by tabs.
| `handleTabSelect(?goog.events.Event e)` Handles {@code SELECT} events dispatched by tabs as they become selected.
| `handleTabUnselect(?goog.events.Event e)` Handles {@code UNSELECT} events dispatched by tabs as they become deselected.
| `isAutoSelectTabs() ⇒ boolean`
| `isSelectableTab(?goog.ui.Control tab) ⇒ boolean` Returns true if the tab is selectable, false otherwise. Only visible and enabled tabs are selectable.
| `listenToTabEvents_()` Subscribes to events dispatched by tabs.
| `removeChild((goog.ui.Control|null|string) control, boolean= opt_unrender) ⇒ ?goog.ui.Control` Removes the tab from the tab bar. Overrides the superclass implementation by deselecting the tab being removed. Since {@link #removeChildAt} uses {@link #removeChild} internally, we only need to override this method.
| `setAutoSelectTabs(boolean enable)` Enables or disables auto-selecting tabs using the keyboard. If auto-select is enabled, keyboard navigation switches tabs immediately, otherwise it just moves the highlight.
| `setHighlightedIndexFromKeyEvent(number index)` Highlights the tab at the given index in response to a keyboard event. Overrides the superclass implementation by also selecting the tab if {@link #isAutoSelectTabs} returns true.
| `setLocation(?goog.ui.TabBar.Location location)` Sets the location of the tab bar relative to tab contents.
| `setSelectedTab(?goog.ui.Control tab)` Selects the given tab.
| `setSelectedTabIndex(number index)` Selects the tab at the given index.

Static Method Summary
| `getOrientationFromLocation(?goog.ui.TabBar.Location location) ⇒ ?goog.ui.Container.Orientation` Returns the {@link goog.ui.Container.Orientation} that is implied by the given {@link goog.ui.TabBar.Location}.