Caprice LogoCaprice UI

Alert

Displays a callout for user attention.

Installation

npx shadcn@latest add @caprice/alert

Usage

import * as Alert from "@/components/caprice-ui/alert"

Examples

Icon

info

Warning

Success

Destructive

Dismissible

Custom

Differences with shadcn/ui / Radix

If you're familiar with Radix UI and shadcn/ui, most patterns will carry over. This guide points out the differences so you can start using Caprice UI without surprises.

Key changes

Featureshadcn/uiCaprice UI
PrimitiveNative <div> elementsBase UI useRender + native <div>
CompositionNonerender prop
API patternFlat exports (Alert, AlertTitle)Namespace pattern (Alert.Root, Alert.Title)
Variantsdefault, destructivedefault, success, info, warning, destructive
Border radiusrounded-lgrounded-xl
Destructive styletext-destructive bg-cardborder-destructive/30 bg-destructive/5 with icon coloring
Semantic colorsNot includedsuccess, info, warning with opacity-based bg/border

Comparison Example

shadcn/ui
<Alert variant="destructive">
  <AlertCircle className="h-4 w-4" />
  <AlertTitle>Error</AlertTitle>
  <AlertDescription>Something went wrong.</AlertDescription>
</Alert>
Caprice UI
<Alert.Root variant="destructive">
  <AlertCircle />
  <Alert.Title>Error</Alert.Title>
  <Alert.Description>Something went wrong.</Alert.Description>
</Alert.Root>

Variants

Prop

Type

Default

API Reference

Root

Prop

Type

Default

Title

Prop

Type

Default

Description

Prop

Type

Default