Getting Started
Components52
- Accordion
- Alert
- Alert Dialog
- Attachment
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Collapsible
- Command
- Context Menu
- Data Table
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toggle
- Toggle Group
- Tooltip
Sync runs every hour
Products, orders and customers update automatically. You can also sync now from the store settings.
import { InfoIcon } from "lucide-react"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
export function AlertDemo() {
return (
<Alert>
<InfoIcon />
<AlertTitle>Sync runs every hour</AlertTitle>
<AlertDescription>
Products, orders and customers update automatically. You can also sync
now from the store settings.
</AlertDescription>
</Alert>
)
}Installation#
pnpm dlx shadcn@latest add https://ui.ikramhasan.com/r/alert.json
Usage#
import {
Alert,
AlertAction,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"<Alert>
<InfoIcon />
<AlertTitle>Heads up!</AlertTitle>
<AlertDescription>
You can add components and dependencies to your app using the cli.
</AlertDescription>
<AlertAction>
<Button variant="outline">Enable</Button>
</AlertAction>
</Alert>Examples#
Title only#
Shopify is connected
import { PlugIcon } from "lucide-react"
import { Alert, AlertTitle } from "@/components/ui/alert"
export function AlertTitleOnly() {
return (
<Alert>
<PlugIcon />
<AlertTitle>Shopify is connected</AlertTitle>
</Alert>
)
}Destructive#
Sync failed
We couldn't reach your store. Check that the app still has access, then try again.
import { CircleAlertIcon } from "lucide-react"
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
export function AlertDestructive() {
return (
<Alert variant="destructive">
<CircleAlertIcon />
<AlertTitle>Sync failed</AlertTitle>
<AlertDescription>
We couldn't reach your store. Check that the app still has access,
then <a href="#alert">try again</a>.
</AlertDescription>
</Alert>
)
}With action#
A new version is available
Reload to get the latest changes.
Your trial ends in 14 days
import { InfoIcon, XIcon } from "lucide-react"
import {
Alert,
AlertAction,
AlertDescription,
AlertTitle,
} from "@/components/ui/alert"
import { Button } from "@/components/ui/button"
export function AlertWithAction() {
return (
<div className="flex flex-wrap items-center gap-2">
<Alert>
<InfoIcon />
<AlertTitle>A new version is available</AlertTitle>
<AlertDescription>Reload to get the latest changes.</AlertDescription>
<AlertAction>
<Button size="sm" variant="secondary">
Reload
</Button>
</AlertAction>
</Alert>
<Alert>
<AlertTitle>Your trial ends in 14 days</AlertTitle>
<AlertAction>
<Button size="icon-sm" variant="ghost" aria-label="Dismiss">
<XIcon />
</Button>
</AlertAction>
</Alert>
</div>
)
}Without icon#
Heads up
Changes to permissions take effect the next time the app syncs.
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
export function AlertWithoutIcon() {
return (
<Alert>
<AlertTitle>Heads up</AlertTitle>
<AlertDescription>
Changes to permissions take effect the next time the app syncs.
</AlertDescription>
</Alert>
)
}API Reference#
Alert#
The Alert component displays a callout for user attention.
| Prop | Type | Default |
|---|---|---|
variant | "default" | "destructive" | "default" |
AlertTitle#
The AlertTitle component displays the title of the alert.
| Prop | Type | Default |
|---|---|---|
className | string | - |
AlertDescription#
The AlertDescription component displays the description or content of the alert.
| Prop | Type | Default |
|---|---|---|
className | string | - |
AlertAction#
The AlertAction component displays an action element (like a button) positioned absolutely in the top-right corner of the alert.
| Prop | Type | Default |
|---|---|---|
className | string | - |