Skip to content

Alert

Inline message with title and description for info, success, warning and error states.

Installation

bun add @xerobi/ui
import { Alert, AlertAction, AlertDescription, AlertTitle } from "@xerobi/ui/alert"

This component is client-side. In Astro, hydrate it with a client directive.

Examples

Variants

import { Alert, AlertDescription, AlertTitle } from "@xerobi/ui/alert"

export function AlertVariants() {
  return (
    <div className="flex w-96 max-w-full flex-col gap-3">
      <Alert variant="info">
        <AlertTitle>Info</AlertTitle>
        <AlertDescription>Something worth knowing.</AlertDescription>
      </Alert>
      <Alert variant="success">
        <AlertTitle>Success</AlertTitle>
        <AlertDescription>All saved.</AlertDescription>
      </Alert>
      <Alert variant="warning">
        <AlertTitle>Warning</AlertTitle>
        <AlertDescription>Check before continuing.</AlertDescription>
      </Alert>
      <Alert variant="destructive">
        <AlertTitle>Error</AlertTitle>
        <AlertDescription>Could not save.</AlertDescription>
      </Alert>
    </div>
  )
}

Variants

variantdefault, destructive, info, success, warning, outlined-info, outlined-success, outlined-warning, outlined-error

API reference

Alert

Also accepts every prop of <div> element.

PropTypeDescription
variant"default" | "destructive" | "info" | "success" | "warning" | "outlined-info" | "outlined-success" | "outlined-warning" | "outlined-error"

AlertAction

Also accepts every prop of <div> element.

No props of its own.

AlertDescription

Also accepts every prop of <div> element.

No props of its own.

AlertTitle

Also accepts every prop of <div> element.

No props of its own.

Styling hooks: [data-slot="alert"], [data-slot="alert-title"], [data-slot="alert-description"], [data-slot="alert-action"].

Search documentation

Search pages, components and blocks.