packages/web-components/src/tablist/readme.md
Tablists allow for navigation between two or more content views and relies on text headers to articulate the different sections of content. Tablist wraps a set of Tab components and manages the roving tabindex (aka "focusgroup") around the elements.
| attribute | type | default | description |
|---|---|---|---|
| activeid | string | - | sets the selected tab |
| appearance | "subtle" | "transparent | "transparent" | - |
| disabled | boolean | - | blocks control and all tab children from all keyboard and mouse events. |
| size | "small" | "medium" | "large" | "medium" | |
| orientation | "vertical" | "horizontal" | "horizontal" | sets the orientation of the tab list to vertical display |
down arrow performs as right arrow and up arrow performs as left arrowdown arrow or up arrowtabindex="0"role, aria-labelledby, aria-label, aria-controls, aria-selected, aria-haspopup, aria-orientationThe Fluent/FAST web component differs from the Fluent React Control as follows:
| difference | Tabs - Fluent Web Component | TabList - Fluent React Component |
|---|---|---|
| active indicator control / id control selection | managed by control | managed by user with application state |
| keyboard and focus selection | selects active tab on arrow key focus change | reselects tab on space bar or enter after arrow refocus |
| icon slotting | favors composition (dev chooses how to slot which icon) | favors automation (dev supplies icon name and control handles the rendering of icon) |
| icon slotting filled / unfilled icons | favors composition over automated handling. requires dev to add interactivity to render filled or unfilled icon | favors automated handling of icons and provides filled and unfilled iconography on selection |
| tab-panels | requires tab panel control to set content on tab selection | does not require or include a tab panel control / template |
| reserve-selected-tab-space | has reserve selected tab space defaulting to true and gives user the option to set to false | removes attribute |
Link to FAST Web Component API
| fluent api name | fast api Equivalent |
|---|---|
| vertical | orientation |
| selected-value | activeid |
| value | id |
By default Tablists are arranged horizontally. The developer sets activeid Tablist attribute. The Component handles the logic of what is shown and hidden when user clicks on the tabs. For switching to work correctly the tab list requires that the indexing of the tabs and tab-panels be organized to correspond to their matching items - the order of the tabs must match the order of the tab panels:
<fluent-tablist>
<fluent-tab>One / Left</fluent-tab>
<fluent-tab>Two / Middle</fluent-tab>
<fluent-tab>Three / Right</fluent-tab>
</fluent-tablist>
If the developer wants to control the selected tab, tab values can be provided.
<fluent-tablist activeid="tab-one">
<fluent-tab id="tab-one">One / Left</fluent-tab>
<fluent-tab id="tab-two">Two / Middle</fluent-tab>
<fluent-tab id="tab-three">Three / Right</fluent-tab>
</fluent-tablist>
<fluent-tablist orientation="vertical">
<fluent-tab>One / Left</fluent-tab>
<fluent-tab>Two / Middle</fluent-tab>
<fluent-tab>Three / Right</fluent-tab>
</fluent-tablist>