- Accordion
- Action Bar
- Alert
- Alert Dialog
- Angle Slider
- Aspect Ratio
- Attachment
- Avatar
- Avatar Group
- Badge
- Badge Overflow
- Banner
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Checkbox Group
- Chip
- Circular Progress
- Client Only
- Collapsible
- Color Picker
- Color Swatch
- Combobox
- Combobox Advanced
- Command
- Compare Slider
- Composition
- Context Menu
- Cropper
- Data Grid
- Data Table
- Data Table Advanced
- Date Picker
- Dialog
- Direction Provider
- Drawer
- Dropdown Menu
- Editable
- Empty
- Field
- File Upload
- Form
- FPS
- Gauge
- Hitbox
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kanban
- Kbd
- Kbd Advanced
- Key Value
- Label
- List
- Listbox
- Map
- Marker
- Marquee
- Mask Input
- Masonry
- Media Player
- Mention
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Number Field
- Pagination
- Pending
- Phone Input
- Pin Input
- Popover
- Portal
- Presence
- Progress
- QR Code
- Questionnaire
- Radio Group
- Range Calendar
- Rating
- Relative Time Card
- Resizable
- Responsive Dialog
- Scroll Area
- Scroll Spy
- Scroller
- Segmented Input
- Select
- Selection Toolbar
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Software Purchase Card
- Sonner
- Sortable
- Speed Dial
- Spinner
- Stack
- Stat
- Status
- Stepper
- Stepper Advanced
- Swap
- Switch
- Table
- Tabs
- Tags Input
- Tags Input Advanced
- Textarea
- Time Picker
- Timeline
- Toast
- Toggle
- Toggle Group
- Tooltip
- Tour
- Typography
- Visually Hidden
- Visually Hidden Input
Jendela yang menumpuk di atas jendela utama atau dialog lain, membuat konten di bawahnya tidak bisa disentuh.
Installation
pnpm dlx shadcn-vue@latest add dialogPasang dependensi berikut:
pnpm add reka-uiSalin dan tempel kode sumber di GitHub ke project Anda.
Sesuaikan path import dengan struktur project Anda.
Usage
vue
<script setup lang="ts">
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog'
</script>
<template>
<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Are you absolutely sure?</DialogTitle>
<DialogDescription>
This action cannot be undone. This will permanently delete your account
and remove your data from our servers.
</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>
</template>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Examples
Tombol Tutup Kustom
Dialog dengan Form
Agar nilai isian tidak hilang setelah Dialog ditutup.
Modal Responsif (Dialog & Drawer)
Pakai komponen Drawer untuk layar kecil, dan Dialog untuk layar yang lebih lebar. Pola ini bisa Anda jadikan komponen pakai-ulang dengan memanfaatkan slot untuk tiap bagian modal.
Catatan
Untuk memakai komponen Dialog dari dalam Context Menu atau Dropdown Menu, Anda harus membungkus komponen Context Menu atau Dropdown Menu tersebut di dalam komponen Dialog.
vue
<template>
<Dialog>
<ContextMenu>
<ContextMenuTrigger>Right click</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem>Open</ContextMenuItem>
<ContextMenuItem>Download</ContextMenuItem>
<DialogTrigger as-child>
<ContextMenuItem>
<span>Delete</span>
</ContextMenuItem>
</DialogTrigger>
</ContextMenuContent>
</ContextMenu>
<DialogContent>
<DialogHeader>
<DialogTitle>Are you absolutely sure?</DialogTitle>
<DialogDescription>
This action cannot be undone. Are you sure you want to permanently
delete this file from our servers?
</DialogDescription>
</DialogHeader>
<DialogFooter>
<Button type="submit">
Confirm
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</template>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30