Alert
Un aviso para información importante, con título, descripción, acción y cinco tonos.
Angular: disponible Vue: disponible React: disponible React Native: disponible
Uso
Heads up
Summaries are generated on this device by default.
Export complete
Weekly sync.md was saved to your notes folder.
3 items are in a locked folder
Unlock the folder to restore or delete them.
Couldn’t reach the server
Your transcript is safe. Try again in a moment.
Ivy noticed a follow-up
“Send the budget draft by Friday” was added to Tasks.
<div class="demo-stack" style="max-width: 34rem">
<div soneAlert>
<sone-icon icon="alert-circle" />
<p soneAlertTitle>Heads up</p>
<p soneAlertDescription>Summaries are generated on this device by default.</p>
</div>
<div soneAlert variant="success" role="status">
<sone-icon icon="check" />
<p soneAlertTitle>Export complete</p>
<p soneAlertDescription>Weekly sync.md was saved to your notes folder.</p>
</div>
<div soneAlert variant="warning" role="status">
<sone-icon icon="lock" />
<p soneAlertTitle>3 items are in a locked folder</p>
<p soneAlertDescription>Unlock the folder to restore or delete them.</p>
<div soneAlertAction><button soneBtn variant="outline" size="xs" type="button">Unlock</button></div>
</div>
<div soneAlert variant="destructive" role="alert">
<sone-icon icon="alert-circle" />
<p soneAlertTitle>Couldn’t reach the server</p>
<p soneAlertDescription>Your transcript is safe. Try again in a moment.</p>
<div soneAlertAction><button soneBtn variant="outline" size="xs" type="button">Retry</button></div>
</div>
@if (hint()) {
<div soneAlert variant="info" role="status" dismissible (dismissed)="hint.set(false)">
<sone-icon icon="sparkles" />
<p soneAlertTitle>Ivy noticed a follow-up</p>
<p soneAlertDescription>“Send the budget draft by Friday” was added to Tasks.</p>
</div>
} @else {
<button soneBtn variant="outline" size="sm" type="button" (click)="hint.set(true)">Show the hint again</button>
}
</div>Importación
import {
SoneAlertActionDirective,
SoneAlertDescriptionDirective,
SoneAlertDirective,
SoneAlertTitleDirective,
} from "@surface-one/angular/alert";Referencia de la API
SoneAlertActionDirectiveDirectiva
SoneAlertDescriptionDirectiveDirectiva
SoneAlertDirectiveComponente
An attribute COMPONENT (still `[soneAlert]`, still `SoneAlertDirective`): the close button of a `dismissible` alert has to be rendered on the server too, which a directive cannot do. The children are projected unchanged.
| Nombre | Tipo | Predeterminado |
|---|---|---|
variant | AlertVariant | "default" |
dismissibleAdds a close button at the end; the owner removes the alert on `(dismissed)`. | boolean | false |
closeLabelThe close button's accessible name. | — | $localize`Dismiss` |
actionsAlignWhere `[soneAlertAction]` sits against a title + description: `start` (top), `center` or `end` (bottom). `null` keeps the default (top with a title, centred on a one-line alert). | AlertActionsAlign | null | null |
| Nombre | Tipo |
|---|---|
dismissedThe close button was pressed. | void |