Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Sections
@shadcn/react
@shadcn/helpers
Utilities
import {
AlertDialog,
AlertDialogAction,インストール#
pnpm dlx shadcn@latest add alert-dialog
使用法#
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@/components/ui/alert-dialog"<AlertDialog>
<AlertDialogTrigger asChild>
<Button variant="outline">Show Dialog</Button>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
<AlertDialogDescription>
This action cannot be undone. This will permanently delete your account
from our servers.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction>Continue</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>構成#
次の構成を使用して、AlertDialog を構築します。
AlertDialog
├── AlertDialogTrigger
└── AlertDialogContent
├── AlertDialogHeader
│ ├── AlertDialogMedia
│ ├── AlertDialogTitle
│ └── AlertDialogDescription
└── AlertDialogFooter
├── AlertDialogCancel
└── AlertDialogAction基本#
タイトル、説明、キャンセルボタンと続行ボタンを備えた基本的なアラートダイアログ。
import {
AlertDialog,
AlertDialogAction,小さい#
size="sm" プロパティを使用して、アラートダイアログを小さくします。
import {
AlertDialog,
AlertDialogAction,メディア#
AlertDialogMedia コンポーネントを使用して、アイコンや画像などのメディア要素をアラートダイアログに追加します。
import { CircleFadingPlusIcon } from "lucide-react"
import {メディア付きの小さいダイアログ#
size="sm" プロパティを使用してアラートダイアログを小さくし、AlertDialogMedia コンポーネントを使用してアイコンや画像などのメディア要素をアラートダイアログに追加します。
import { BluetoothIcon } from "lucide-react"
import {破壊的#
AlertDialogAction コンポーネントを使用して、破壊的なアクションボタンをアラートダイアログに追加します。
import { Trash2Icon } from "lucide-react"
import {RTL#
shadcn/ui で RTL サポートを有効にするには、RTL 構成ガイド を参照してください。
"use client"
import * as React from "react"API リファレンス#
サイズ#
AlertDialogContent コンポーネントの size プロパティを使用して、アラートダイアログのサイズを制御します。次の値を受け入れます。
| プロパティ | タイプ | デフォルト |
|---|---|---|
size | "default" | "sm" | "default" |
他のコンポーネントとそのプロパティの詳細については、Radix UI ドキュメント を参照してください。
shadcn/uiアプリをVercelにデプロイ
OpenAI、Sonos、Adobeなどに採用されています。
Vercelは、アプリや機能を大規模にデプロイするためのツールと インフラを提供します。
Vercelにデプロイ