Scroll Area
Un contenitore di scorrimento con barre sottili nei colori dei token e lo scorrimento nativo del browser: verticale, orizzontale o entrambi, raggiungibile da tastiera quando il contenuto trabocca, con bordi sfumati opzionali.
Angular: disponibile Vue: disponibile React: disponibile React Native: non ancora disponibile
Utilizzo
Tags
--accent--accent-soft--surface-hover--success--warning--danger<div class="demo-row" style="align-items: flex-start">
<div soneScrollArea aria-label="Release tags"
style="height: 14rem; width: 12rem; padding: var(--space-4); border: var(--border-width-thin) solid var(--border); border-radius: var(--radius-md)">
<p style="margin: 0 0 var(--space-3); font-weight: var(--font-weight-medium)">Tags</p>
@for (tag of tags; track tag) {
<div style="font-size: var(--font-size-sm)">{{ tag }}</div>
<div soneSeparator style="margin-block: var(--space-2)"></div>
}
</div>
<div style="width: 18rem; border: var(--border-width-thin) solid var(--border); border-radius: var(--radius-md)">
<div soneScrollArea orientation="horizontal" fade aria-label="Swatches">
<div style="display: flex; gap: var(--space-3); padding: var(--space-4); width: max-content">
@for (swatch of swatches; track swatch) {
<div style="display: grid; gap: var(--space-2); justify-items: start">
<div [style.background]="'var(--' + swatch + ')'"
style="width: 6rem; height: 6rem; border-radius: var(--radius-md); border: var(--border-width-thin) solid var(--border)"></div>
<code style="font-size: var(--font-size-xs)">--{{ swatch }}</code>
</div>
}
</div>
</div>
</div>
</div>Importazione
import {
SoneScrollAreaDirective,
} from "@surface-one/angular/scroll-area";Riferimento API
SoneScrollAreaDirectiveDirettiva
`[soneScrollArea]` — a scroll container with thin, token-coloured scrollbars (shadcn/ui ScrollArea, spartan/ui Scroll Area) that keeps the browser's own scrolling: no scrollbar is emulated. Give it a height (or a width for `horizontal`); `orientation` picks the axes that scroll (`vertical`, `horizontal` or `both`). While its content overflows it is a keyboard stop (`tabindex="0"`, unless you set one) so the arrow keys scroll it, and a named one (`aria-label`) is a `region`. `fade` softens the edges where content is hidden (it masks the whole box, so draw a border on a wrapper).
| Nome | Tipo | Predefinito |
|---|---|---|
orientation | ScrollAreaOrientation | "vertical" |
fadeFade the content out at the edges where more of it is hidden. | boolean | false |