Alert With Actions
shadcn-ui-blocks/alert-10FreeComponent
An alert with actions component
Install it
npx shadcn@latest add https://shadcnui-blocks.com/r/alert-10.jsonSource
1"use client";23import { CircleFadingArrowUpIcon, XIcon } from "lucide-react";4import { useState } from "react";5import { Alert, AlertDescription, AlertTitle } from "@/registry/ui/alert";6import { Button } from "@/registry/ui/button";78export default function AlertWithActionsDemo() {9 const [isAlertVisible, setIsAlertVisible] = useState(true);1011 const showAlert = () => {12 setIsAlertVisible(true);13 };14 const hideAlert = () => {15 setIsAlertVisible(false);16 };1718 return (19 <div className="w-full">20 {isAlertVisible && (21 <Alert className="flex items-center justify-between pr-2 [&>svg+div]:translate-y-0">22 <div className="flex items-start gap-3">23 <CircleFadingArrowUpIcon className="mt-0.5 size-4" />24 <div className="flex-col justify-center">25 <AlertTitle>Update Available</AlertTitle>26 <AlertDescription>27 A new version of the app is now available.28 </AlertDescription>29 </div>30 </div>31 <Button32 className="pl-0!"33 onClick={hideAlert}34 size="icon"35 variant="ghost"36 >37 <XIcon className="h-5 w-5" />38 </Button>39 </Alert>40 )}41 {!isAlertVisible && (42 <div className="flex justify-center">43 <Button className="mx-auto mt-2" onClick={showAlert}>44 Reopen45 </Button>46 </div>47 )}48 </div>49 );50}
What it pulls in
npm packages
Other registry items
Files it writes
More from Shadcn UI Blocks
All 542 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Default Accordionaccordion-01 | Shadcn UI Blocks | Components | Free | no deps | |
| Outline Accordionaccordion-02 | Shadcn UI Blocks | Components | Free | no deps | |
| Box Accordionaccordion-03 | Shadcn UI Blocks | Components | Free | no deps | |
| Contained Accordionaccordion-04 | Shadcn UI Blocks | Components | Free | no deps | |
| Box Contained Accordionaccordion-05 | Shadcn UI Blocks | Components | Free | no deps | |
| Tabs Accordionaccordion-06 | Shadcn UI Blocks | Components | Free | no deps | |
| Highlight Active Item Accordionaccordion-07 | Shadcn UI Blocks | Components | Free | no deps | |
| Multiple Expanded at a time Accordionaccordion-08 | Shadcn UI Blocks | Components | Free | no deps |
