Alert
Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.
Installation
To get started, install @sgroup/alert
via npm:
npm install @sgroup/alert
Basic example
Alerts are built using the Alert
and AlertClose
components.
WARNING
Ensure you change the components
definition to include Sui
as a prefix, as some component names conflict with native HTML element names and will not work.
<template>
<sui-alert>
Your changes were made successfully.
<sui-alert-close>
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" /></svg>
</sui-alert-close>
</sui-alert>
</template>
<script>
import { Alert, AlertClose } from '@sgroup/alert';
export default {
components: {
SuiAlert: Alert,
SuiAlertClose: AlertClose,
},
};
</script>
Component API
Alert
The main Alert
component.
Prop | Type | Default | Description |
---|---|---|---|
tagName | String | div | The element the Alert should render as. |
v-model:show | Boolean | false | Whether the Alert is shown or not. |
AlertClose
The trigger component that closes an Alert
.
Prop | Type | Default | Description |
---|---|---|---|
tagName | String | div | The element the AlertClose should render as. |