BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/cubby-ui/alert

Alert

cubby-ui/alert
FreeComponent

A alert component.

Live preview

live · rendered by the registry
Rendered by cubby-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://cubby-ui.dev/r/alert.json

Source

registry/default/alert/alert.tsxcubby-ui.dev/r/alert.json
1"use client";
2
3import { cva, type VariantProps } from "class-variance-authority";
4import { mergeProps } from "@base-ui/react/merge-props";
5import { useRender } from "@base-ui/react/use-render";
6
7import { cn } from "@/lib/utils";
8
9const alertVariants = cva(
10 "relative w-full rounded-lg border border-border/70 px-4 py-3 pl-6 text-sm grid has-[>svg]:grid-cols-[auto_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:row-span-2 [&>svg]:text-current shadow-sm has-[*[data-slot=alert-action]]:grid-cols-[0_1fr] has-[>svg]:has-[*[data-slot=alert-action]]:grid-cols-[auto_1fr] sm:has-[*[data-slot=alert-action]]:grid-cols-[0_1fr_auto] sm:has-[>svg]:has-[*[data-slot=alert-action]]:grid-cols-[auto_1fr_auto] [&>svg]:size-5 group before:absolute before:left-2 before:top-2 before:bottom-2 before:w-1 before:rounded-full bg-card dark:bg-muted",
11 {
12 variants: {
13 variant: {
14 default: "[&>svg]:text-card-foreground before:bg-border",
15 warning:
16 " [&>svg]:text-warning-foreground before:bg-warning-foreground",
17 danger: " [&>svg]:text-danger-foreground before:bg-danger-foreground",
18 info: " [&>svg]:text-info-foreground before:bg-info-foreground",
19 success:
20 " [&>svg]:text-success-foreground before:bg-success-foreground",
21 },
22 },
23 defaultVariants: {
24 variant: "default",
25 },
26 },
27);
28
29export interface AlertProps
30 extends useRender.ComponentProps<"div">, VariantProps<typeof alertVariants> {}
31
32function Alert({ className, variant, render, ...props }: AlertProps) {
33 const defaultProps = {
34 "data-slot": "alert",
35 role: "alert" as const,
36 className: cn(alertVariants({ variant }), className),
37 };
38
39 const element = useRender({
40 defaultTagName: "div",
41 render,
42 props: mergeProps<"div">(defaultProps, props),
43 });
44
45 return element;
46}
47
48export type AlertTitleProps = useRender.ComponentProps<"h4">;
49
50function AlertTitle({ className, render, ...props }: AlertTitleProps) {
51 const defaultProps = {
52 "data-slot": "alert-title",
53 className: cn(
54 "col-start-2 min-h-4 font-medium tracking-tight row-span-2 self-center group-has-[*[data-slot=alert-description]]:row-span-1 text-card-foreground",
55 className,
56 ),
57 };
58
59 const element = useRender({
60 defaultTagName: "h4",
61 render,
62 props: mergeProps<"h4">(defaultProps, props),
63 });
64
65 return element;
66}
67
68export type AlertDescriptionProps = useRender.ComponentProps<"div">;
69
70function AlertDescription({
71// … truncated

What it pulls in

npm packages

  • class-variance-authority

Files it writes

  • registry/default/alert/alert.tsx

Facts

Registry
cubby-ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
today

Go to the source

Docs on cubby-ui cubby-ui.dev joncoronel/cubby-ui on GitHub Raw registry item This item as JSON

More from cubby-ui

All 79 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordioncubby-uiComponentsFree2 deps
Alert-dialogalert-dialogcubby-uiComponentsFree2 deps
Aspect-ratioaspect-ratiocubby-uiComponentsFreeno deps
Autocompleteautocompletecubby-uiComponentsFree2 deps
Avataravatarcubby-uiComponentsFree1 dep
Badgebadgecubby-uiComponentsFree1 dep
Base Drawerbase-drawercubby-uiComponentsFree2 deps
Breadcrumbsbreadcrumbscubby-uiComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex