ReadonlyactiveClasses to add to the panel content when active.
The id of the panel (not the tab/trigger) that's currently active.
ReadonlycontextThe key for reading/applying history state if locationSync is enabled, based on the controller's identifier.
ReadonlypanelTab content panels, with role='tabpanel', showing the content for each tab.
Trigger elements that are the primary tabs, with role='tab' within the role='tablist'.
ReadonlytriggerAny elements within the controller's scope that may select a specific panel.
ReadonlyuseIf true, the selected tab will sync with the URL hash and the URL hash will be checked on load for a selected tab panel (or panel contents).
StaticblessingsStaticclassesStaticoutletsStatictargetsStaticvaluesValidates and patches in missing aria-controls values if needed.
Returning only the triggers that are located within tablist.
StaticshouldHandles the completion of a transition or animation on the given element. If transitions are enabled via CSS, the Promise returned will resolve when either the animation is finished or the transition timeout value is reached. If transitions are not enabled, an immediately-resolved Promise is returned.
Set the active panel based on a provided id from the event or a target element
which is assumed to be a tab element, that has been passed in.
If the focus parameter is set to true, the target element will be focused if it
is a valid tab, otherwise the matching tab will be focused.
Optionalevent: Allow selection based on an event being dispatched from inside a tab panel.
Set the active panel based on the next tab in the DOM order. If the current active panel is already the last tab, keep this panel active.
Optionalevent: EventSet the active panel based on the previous tab in the DOM order. If the current active panel is already the first tab, keep this panel active.
Optionalevent: EventIf the initial panel is found, set it as the active panel, if the value is already set (from the DOM value), trigger the value changed callback.
If no initial panel is found, the first tab will be selected.
Update the URL (location) hash based on the active panel id, only if configured to be syncing location. If state is available, add a new history item to the stack.
StaticafterWhenever the active panel has changed, handle transitions and selection from the current to the new panels.
Set the non-active panels to tabindex="-1" and aria-selected="false" so that they are not focusable and not selected, allowing the tabs to be controlled via keyboard arrows and Home/End keys.
Validate & clean targets, set the initial active panel, hide any non active panels then dispatch ready.
Once ready, allow for targets to change and reset the tabs & validation.
Adds the ability for the controlled elements to behave as selectable tabs where one panel will be active at a time.
Description
role="tab"attribute and either ahrefwith the tab contentidwith the targettabor aaria-controlsset to a targettab.role="tablist"attribute.role="tabpanel"attribute and andidattribute that matches thehrefof the tab link with the target 'panel'.hrefto theidof the tab you would like to trigger or use action params.Uses the tabs pattern from the WAI-ARIA Authoring Practices Guide (APG).
See
https://www.w3.org/WAI/ARIA/apg/patterns/tabs/
Example: - Basic tabs (with initial selection)
Example: - Full tabs with class changes, history/location handling, keyboard controls, selection from inside & extra trigger