BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/blok/alert

Alert

blok/alert
FreeComponent

Displays important information after an action.

Install it

npx shadcn@latest add https://blok.sitecore.com/r/alert.json

Source

src/components/ui/alert.tsxblok.sitecore.com/r/alert.json
1import { mdiAlertCircle, mdiCheckCircle, mdiInformation } from "@mdi/js";
2import { type VariantProps, cva } from "class-variance-authority";
3import type * as React from "react";
4
5import { Icon } from "@/lib/icon";
6import { cn } from "@/lib/utils";
7
8const alertVariants = cva(
9 "relative w-full rounded-md px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-4 gap-y-0.5 items-center [&>svg]:size-4 [&>svg]:text-current",
10 {
11 variants: {
12 variant: {
13 default:
14 "bg-primary-bg [&>svg]:text-primary-500 dark:[&>svg]:text-primary-200",
15 primary:
16 "bg-primary-bg [&>svg]:text-primary-500 dark:[&>svg]:text-primary-200",
17 danger:
18 "bg-danger-bg [&>svg]:text-danger-500 dark:[&>svg]:text-danger-200",
19 warning:
20 "bg-warning-bg [&>svg]:text-warning-500 dark:[&>svg]:text-warning-200",
21 success:
22 "bg-success-bg [&>svg]:text-success-500 dark:[&>svg]:text-success-200",
23 },
24 },
25 defaultVariants: {
26 variant: "default",
27 },
28 },
29);
30
31const variantIcons = {
32 default: mdiInformation,
33 primary: mdiInformation,
34 danger: mdiAlertCircle,
35 warning: mdiAlertCircle,
36 success: mdiCheckCircle,
37};
38
39function Alert({
40 className,
41 variant = "default",
42 ...props
43}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {
44 return (
45 <div
46 data-slot="alert"
47 role="alert"
48 className={cn(alertVariants({ variant }), className)}
49 {...props}
50 >
51 {variant && (
52 <Icon
53 path={variantIcons[variant]}
54 size={1.2}
55 className="text-current"
56 />
57 )}
58 {props.children}
59 </div>
60 );
61}
62
63function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
64 return (
65 <div
66 data-slot="alert-title"
67 className={cn(
68 "col-start-2 line-clamp-1 min-h-4 font-semibold tracking-tight",
69 className,
70 )}
71 {...props}
72 />
73 );
74}
75
76function AlertDescription({
77 className,
78 ...props
79}: React.ComponentProps<"div">) {
80 return (
81 <div
82 data-slot="alert-description"
83 className={cn(
84 "text-md col-start-2 grid justify-items-start gap-1 [&_p]:leading-relaxed",
85 className,
86 )}
87 {...props}
88 />
89 );
90}
91
92export { Alert, AlertTitle, AlertDescription };

What it pulls in

npm packages

  • @mdi/js
  • class-variance-authority

Other registry items

  • https://blok.sitecore.com/r/theme.json

Files it writes

  • src/components/ui/alert.tsx
  • src/lib/icon.tsx

Facts

Registry
blok
Type
registry:ui
Access
Free
Files written
2
Licence
NOASSERTION
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

blok.sitecore.com Sitecore/blok on GitHub Raw registry item This item as JSON

More from blok

All 72 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionblokComponentsFree2 deps · 2 files
Action baraction-barblokComponentsFree1 dep · 2 files
Alert dialogalert-dialogblokComponentsFree2 deps
Aspect ratioaspect-ratioblokComponentsFree1 dep
AvataravatarblokComponentsFree1 dep
BadgebadgeblokComponentsFree2 deps
All componentsblok-componentsblokComponentsFreeno deps
BreadcrumbbreadcrumbblokComponentsFree2 deps · 2 files
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