Alert
安装
npx shadcn@latest add https://ssp-ui-registry-staging.sh3.agoralab.co/r/alert.jsonyarn dlx shadcn@latest add https://ssp-ui-registry-staging.sh3.agoralab.co/r/alert.jsonpnpx shadcn@latest add https://ssp-ui-registry-staging.sh3.agoralab.co/r/alert.jsonbunx shadcn@latest add https://ssp-ui-registry-staging.sh3.agoralab.co/r/alert.json参考
示例
Success! Your changes have been saved
This is an alert with icon, title and description.
This Alert has a title and an icon. No description.
Unable to process your payment.
Please verify your billing information and try again.
- Check your card details
- Ensure sufficient funds
- Verify billing address
import { AlertCircleIcon, CheckCircle2Icon, PopcornIcon } from "lucide-react"import { Alert, AlertDescription, AlertTitle } from "@/registry/ssp/ui/alert"export default function Example() {return ( <div className='grid w-full max-w-xl items-start gap-4'> <Alert> <CheckCircle2Icon /> <AlertTitle>Success! Your changes have been saved</AlertTitle> <AlertDescription> This is an alert with icon, title and description. </AlertDescription> </Alert> <Alert> <PopcornIcon /> <AlertTitle> This Alert has a title and an icon. No description. </AlertTitle> </Alert> <Alert variant='destructive'> <AlertCircleIcon /> <AlertTitle>Unable to process your payment.</AlertTitle> <AlertDescription> <p>Please verify your billing information and try again.</p> <ul className='list-inside list-disc text-sm'> <li>Check your card details</li> <li>Ensure sufficient funds</li> <li>Verify billing address</li> </ul> </AlertDescription> </Alert> </div>)}