Tab Strip
Schede di documento per una finestra desktop: un punto di stato e una nota per scheda, pulsanti di chiusura e nuova scheda, frecce e Canc o ⌘W per chiudere.
Angular: disponibile Vue: disponibile React: disponibile React Native: non ancora disponibile
Utilizzo
Release plan
Agent run
Review notes
<div
style="display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-2); border-radius: var(--island-radius); background: var(--app-backdrop)"
>
<sone-tab-strip
ariaLabel="Documents"
panelIdPrefix="doc"
[tabs]="tabs()"
[(active)]="active"
closable
addable
(close)="close($event)"
(add)="add()"
>
<span soneTabStripTrailing class="text-hint">{{ tabs().length }} open</span>
</sone-tab-strip>
@for (tab of tabs(); track tab.id) {
<section
role="tabpanel"
[id]="'doc-' + tab.id"
[attr.aria-labelledby]="'doc-tab-' + tab.id"
[hidden]="tab.id !== active()"
tabindex="0"
style="min-height: 8rem; padding: var(--space-4); border-radius: var(--island-radius); background: var(--surface-base); box-shadow: var(--island-shadow)"
>
<p>{{ tab.label }}</p>
</section>
}
</div>Importazione
import {
SoneTabStripComponent,
SoneTabStripTrailingDirective,
} from "@surface-one/angular/tab-strip";Riferimento API
SoneTabStripComponentComponente
`<sone-tab-strip>` — document tabs for a desktop window (the WAI-ARIA Tabs pattern): a `tablist` of `tabs`, the selected one `[(active)]`, each with an optional status dot (`busy` pulses) and a short note. `closable` gives every tab a close button — a sibling of the tab, so the tab stays one control — and `addable` a "New tab" button. ←/→, Home and End move between tabs; Delete or ⌘W closes the focused one. Each tab points at its panel: `id="<panelIdPrefix>-<tab id>"`, labelled by `<panelIdPrefix>-tab-<tab id>`.
| Nome | Tipo | Predefinito |
|---|---|---|
tabs | readonly TabStripTab[] | [] |
activebidirezionaleThe selected tab's id — `[(active)]`. | string | null | null |
ariaLabelNames the tab list. | string | $localize`:A tab strip's tab list:Tabs` |
closableGives every tab a close button (and Delete / ⌘W). | boolean | false |
addableShows the "New tab" button after the tabs. | boolean | false |
panelIdPrefixThe id prefix the panels use, so each tab can point at its panel. | string | "tab-panel" |
| Nome | Tipo |
|---|---|
closeA tab's close button or Delete / ⌘W on it: the parent removes it and picks the new active tab. | string |
addThe "New tab" button. | void |
SoneTabStripTrailingDirectiveDirettiva
Content after the tabs, pushed to the end of the strip (a search, an account).