Rail
Eine schmale Spalte aus Symbolschaltflächen neben der Seite für die Orte einer App, mit hervorgehobenem aktuellem Ort, Tooltips und Badges für „beschäftigt“, „Achtung“ oder „ok“.
Angular: verfügbar Vue: verfügbar React: verfügbar React Native: noch nicht verfügbar
Verwendung
Current place: home
<div
style="display: flex; gap: var(--space-2); height: 22rem; padding: var(--space-2); border-radius: var(--island-radius); background: var(--app-backdrop)"
>
<sone-rail ariaLabel="Demo app">
<div soneRailGroup>
@for (place of places; track place.id) {
<sone-rail-button
[icon]="place.icon"
[label]="place.label"
[badge]="place.badge"
[current]="current() === place.id"
(click)="current.set(place.id)"
/>
}
</div>
<div soneRailGroup>
<sone-rail-button
icon="settings"
label="Settings"
[current]="current() === 'settings'"
(click)="current.set('settings')"
/>
</div>
</sone-rail>
<section
style="flex: 1; padding: var(--space-4); border-radius: var(--island-radius); background: var(--surface-base); box-shadow: var(--island-shadow)"
>
<p class="text-hint">Current place: {{ current() }}</p>
</section>
</div>Import
import {
SoneRailButtonComponent,
SoneRailComponent,
SoneRailGroupDirective,
} from "@surface-one/angular/rail";API-Referenz
SoneRailButtonComponentKomponente
`<sone-rail-button>` — one place on a rail: a square icon button whose `label` is its accessible name and its tooltip (`title`). `current` marks the place on screen (`aria-current="page"`): a raised island with the accent icon. `badge` adds a status dot in the corner (busy pulses); say the status in the label when it matters.
| Name | Typ | Standard |
|---|---|---|
iconerforderlich | ShellIcon | — |
labelerforderlichThe accessible name and the tooltip. | string | — |
currentThe place on screen now (`aria-current="page"`). | boolean | false |
badgeA status dot in the corner. | RailBadge | null | null |
disabled | boolean | false |
SoneRailComponentKomponente
`<sone-rail>` — a narrow column of icon buttons beside the page (on the glass in the Surface skin): app-level places such as Home, Search or Settings. A `nav` landmark named by `ariaLabel`; put the buttons in `[soneRailGroup]` blocks — the first group sits at the top, the last at the bottom.
| Name | Typ | Standard |
|---|---|---|
ariaLabelNames the navigation landmark. | string | $localize`:The rail's navigation landmark:Main` |
SoneRailGroupDirectiveDirektive
A column of rail buttons; the rail spreads its groups from top to bottom.