Rail
Une colonne étroite de boutons à icône à côté de la page pour les lieux de l’application, avec le lieu actuel en relief, des infobulles et des pastilles « occupé », « attention » ou « ok ».
Angular: disponible Vue: disponible React: disponible React Native: pas encore disponible
Utilisation
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>Importation
import {
SoneRailButtonComponent,
SoneRailComponent,
SoneRailGroupDirective,
} from "@surface-one/angular/rail";Référence de l’API
SoneRailButtonComponentComposant
`<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.
| Nom | Type | Par défaut |
|---|---|---|
iconobligatoire | ShellIcon | — |
labelobligatoireThe 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 |
SoneRailComponentComposant
`<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.
| Nom | Type | Par défaut |
|---|---|---|
ariaLabelNames the navigation landmark. | string | $localize`:The rail's navigation landmark:Main` |
SoneRailGroupDirectiveDirective
A column of rail buttons; the rail spreads its groups from top to bottom.