Tab
A tab of a tab list: an optional icon, the title, an optional badge, and a close button or a busy spinner. Its owner puts it in an element with the tablist role and moves focus between tabs; only the selected tab is in the tab order. A click, Enter or Space activates it; Delete, a middle click or its close button closes it when it is closable. While its title is cut, a tooltip below the tab shows the whole title on hover and on keyboard focus; a tab whose title fits shows none. Escape on a focused tab whose tooltip is shown only hides the tooltip, so in a dialog the first Escape leaves the dialog open.
Examples
Loading…
States
Loading…
API
Selector nol-tab
Import from @noldova/ui.components.angular
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
label | string | Required | The title, which is also the start of the accessible name. |
icon | string | undefined | The glyph before the title; none when not bound. |
selected | boolean | false | Whether the tab is the selected one, which is highlighted and in the tab order; false when not bound. |
preview | boolean | false | Whether the tab is a preview, which the next preview replaces; it shows in italics and assistive technology describes it as a preview. False when not bound. |
working | boolean | false | Whether the tab's content is busy, which shows a spinner where the close button is, or before the title with |
waiting | boolean | false | Whether the tab waits for the person, for example for an approval, which shows a raised hand in the spinner's place and at its size, and adds "waiting for your answer" to the end of the accessible name. It wins over |
closable | boolean | true | Whether the person can close the tab, which shows its close button; true when not bound. |
badge | string | null | What the badge means, which the accessible name includes after the title and any status, marker and underline, or null for no badge; null when not bound. |
badgeCount | number | null | The count the badge shows, or null for a dot; shown only with a |
image | string | null | The address of a small image before the title, such as a site's icon, 0.875rem square with 0.1875rem corners and never stretched, in place of |
imageGlyph | string | null | The glyph in the image's place, such as |
status | TabStatus | null | A status glyph in the image's place, colored by its tone, whose description the accessible name includes after the title; null when not bound. |
leadingSpinner | boolean | false | Whether a working tab shows its spinner before the title, 0.75rem with a 1.5px stroke, in place of its image, status or icon, and keeps its close button at the end, as it is when not working; false when not bound, which keeps the spinner at the end. The waiting hand still wins. |
marker | TabMarker | null | A glyph before everything else, in the accent color, with its own tooltip, whose label the accessible name includes after the status's description; null when not bound. |
underline | string | null | What the accent underline means, such as "A teammate is using this page": set, the tab draws a 2px accent line inside its bottom edge, in the highlight color under forced colors, and the accessible name includes it after the marker's label and before the badge; null when not bound. |
editing | boolean | false | Whether the title is being edited in place: set, the label becomes the kit's text field, named "Tab title", on the label's own box, so its text starts where the label's text started and the tab, its icon, badge and close button keep their size and place. The field starts with the current title, focused and selected; a title changed meanwhile never overwrites what is typed, and the field's keys and clicks never activate or close the tab. The owner sets it back to false when |
Outputs
| Name | Type | Description |
|---|---|---|
activate | void | Emits when the person activates the tab; the owner selects it. |
close | void | Emits when the person closes a closable tab; the owner removes it. |
labelKept | string | Emits the field's trimmed text, possibly empty, when the person presses Enter or the field loses the focus while editing; the owner decides what the text means and leaves the mode. Emits at most once per editing session, and not for an Enter that ends a composition. |
labelCancelled | void | Emits when the person presses Escape while editing; the owner leaves the mode and keeps the title. Emits at most once per editing session, and never after |
Accessibility
| Key | Action |
|---|---|
| Tab | Moves the focus to the selected tab, the tab list's one Tab stop, and then past the tab list. |
| Arrow Right | Moves the focus to the next tab, from the last to the first. The tab list's owner handles it, as this example's does: a tab leaves moving between tabs to its owner. |
| Arrow Left | Moves the focus to the previous tab, from the first to the last, through the same owner. |
| Home | Moves the focus to the first tab, through the same owner. |
| End | Moves the focus to the last tab, through the same owner. |
| Enter | Activates the focused tab, which its owner selects. |
| Space | Activates the focused tab, as Enter does. |
| Delete | Closes the focused tab, unless it is not closable. |
| Escape | Hides the tooltip of a focused tab whose title is cut, and does nothing more, so a dialog around it stays open. |
Each tab has the tab role, inside an element its owner gives the tablist role and a name; it is marked selected or not, and only the selected tab is in the Tab order.
Its accessible name is its whole title, then what its status, its marker, its underline and its badge say, and waiting for your answer while it waits, each after a comma; a preview tab is described as Preview.
A working tab is busy unless it waits for the person; its spinner, icon and glyphs are hidden from assistive technology.
Its close button is named Close and the title, and is out of the Tab order; Delete closes the focused tab instead.
While its title is cut, a tooltip below the tab shows the whole title on hover and on keyboard focus.
Specification
Loading…