Alert

@sgroup/alert

Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

With close button

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.

PropTypeDefaultDescription
tagNameStringdivThe element the Alert should render as.
v-model:showBooleanfalseWhether the Alert is shown or not.

AlertClose

The trigger component that closes an Alert.

PropTypeDefaultDescription
tagNameStringdivThe element the AlertClose should render as.