Informs users about important changes or persistent conditions. Use this component if you need to communicate to users in a prominent way. Alerts are placed at the top of the page or section they apply to, and below the page or section header.
Use to convey general information or actions that aren't critical. For example, you might show an alert that asks for users feedback. Default alerts contain lower priority information and should always be dismissable.
<script lang="ts" setup>
import { Alert, AlertDescription, AlertTitle } from '@returnless/focus-ui';
</script>
<template>
<Alert>
<AlertTitle>Heads up!</AlertTitle>
<AlertDescription>
You can add components to your app using the cli.
</AlertDescription>
</Alert>
</template>Use to communicate general information or actions that aren't critical. For example, you might show an alert that informs users about a new feature. Info alerts contain lower priority information.
<script lang="ts" setup>
import { Alert, AlertDescription, AlertTitle } from '@returnless/focus-ui';
</script>
<template>
<Alert variant="informative">
<AlertTitle>Heads-up</AlertTitle>
<AlertDescription>
A new version of the app is available. Refresh your browser to update.
</AlertDescription>
</Alert>
</template>Use to communicate critical information or actions that require immediate attention. For example, you might show an alert that warns users about a critical system failure. Destructive alerts contain higher priority information.
<script lang="ts" setup>
import { Alert, AlertDescription, AlertTitle } from '@returnless/focus-ui';
</script>
<template>
<Alert variant="destructive">
<AlertTitle>Error</AlertTitle>
<AlertDescription>
Your session has expired. Please log in again.
</AlertDescription>
</Alert>
</template>Use to display information that needs attention or that user need to take action on. Seeing these banners can be stressful for user so be cautious about using them.
<script lang="ts" setup>
import { Alert, AlertDescription, AlertTitle } from '@returnless/focus-ui';
</script>
<template>
<Alert variant="warning">
<AlertTitle>Before you can purchase a shipping label, this change needs to be made:</AlertTitle>
<AlertDescription>
The name of the city you’re shipping to has characters that aren’t allowed. City name can only include spaces and hyphens.
</AlertDescription>
</Alert>
</template>Alerts should:
Alerts should be placed in the appropriate context:
Alerts should:
Body content should:
Alerts provide context and assist workflows for users with disabilities.
role="alert" attribute and are announced by assistive technologies when they appear.role="status" attribute and are read after any critical announcements.tabindex="0" attribute and display a visible keyboard focus indicator. Because of this, merchants can discover banners while tabbing through forms or other interactions, and developers can programmatically move focus to banners.