App Bar
La barre supérieure d’un écran : un bouton ou un lien de retour, le titre en vrai titre de section avec un sous-titre et des actions à la fin, dans un header qui peut rester collé en haut et évite l’encoche.
Angular: disponible Vue: disponible React: disponible React Native: disponible
Utilisation
Back pressed 0 times
<div class="demo-stack" style="max-width: 24rem">
<sone-app-bar
title="Inbox"
subtitle="12 unread"
[level]="3"
showBack
(back)="backs.set(backs() + 1)"
>
<button soneAppBarTrailing soneBtn type="button" variant="ghost" size="icon" aria-label="Search">
<sone-icon icon="search" />
</button>
</sone-app-bar>
<p class="text-hint" aria-live="polite">Back pressed {{ backs() }} times</p>
</div>Importation
import {
SoneAppBarComponent,
SoneAppBarTrailingDirective,
} from "@surface-one/angular/app-bar";Référence de l’API
SoneAppBarComponentComposant
`<sone-app-bar>` — the top bar of a screen (the web twin of the React Native `SoneAppBar`): an optional back button, the title as a real heading (`level`, default 1) with a subtitle under it, and `[soneAppBarTrailing]` actions at the end. It renders a `<header>`, so it is the page's banner when it sits outside `main`. `sticky` pins it to the top of the scrolling page; its top padding clears the notch (`env(safe-area-inset-top)`). `showBack` draws a back button that emits `(back)`; `backHref` makes it a link.
| Nom | Type | Par défaut |
|---|---|---|
titleobligatoire | string | — |
subtitleA line under the title. | string | null | null |
levelThe title's heading level, 1–6. | HeadingLevel | 1 |
showBackShows the back button, which emits `(back)`. | boolean | false |
backHrefMakes the back button a link to this URL (it shows without `showBack`). | string | null | null |
backLabelThe back button's accessible name. | — | $localize`:Goes back to the previous screen:Back` |
stickyPins the bar to the top of the scrolling page. | boolean | false |
| Nom | Type |
|---|---|
backThe back button was pressed (not emitted for a `backHref` link). | void |
SoneAppBarTrailingDirectiveDirective
`[soneAppBarTrailing]` — what sits at the end of the bar: icon buttons, an avatar …