On this page

Alert

Install, props and the parts Alert is built from.

Install

Run this in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/alert.json

Use

<script setup lang="ts">
import { TriangleAlert } from '@lucide/vue'
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'
</script>

<template>
  <Alert variant="warning" role="status">
    <TriangleAlert />
    <AlertTitle>Stock levels are 2 hours old</AlertTitle>
    <AlertDescription>The warehouse connection is slow.</AlertDescription>
  </Alert>
</template>

Props

Part Prop Values Notes
Alert variant default, info, success, warning, destructive, danger danger is the same as destructive
Alert role alert (default), status, note alert is read out at once; use status for a banner that is there from the start
AlertTitle, AlertDescription class string
AlertAction class string Holds one small button, in its own column at the end

An icon placed as the first child of Alert gets its own column, size.icon.default and the role colour.

Built on

Plain elements and class-variance-authority, with the control-center Alert API. Beehexa adds the status roles, the danger alias and a grid column for the action (the source placed it absolutely, which long labels overflowed).