dialog

Dialog

A modal window over the page, with a header, a body that scrolls when it outgrows the screen, and a footer for actions such as save and cancel.

Parts

PartFileDoes
DialogDialog.vueGroups all parts of the dialog.
DialogBodyDialogBody.vueHolds the dialog's main content and scrolls it when the dialog outgrows the screen, keeping the header and footer in view.
DialogCloseDialogClose.vueCloses the dialog.
DialogContentDialogContent.vueHolds what the dialog shows while open.
DialogDescriptionDialogDescription.vueExplains the purpose of the dialog below its title.
DialogFooterDialogFooter.vueHolds the actions of the dialog, such as confirm and cancel buttons.
DialogHeaderDialogHeader.vueGroups the title and description at the top of the dialog.
DialogOverlayDialogOverlay.vueCovers the page behind the open dialog.
DialogScrollContentDialogScrollContent.vueHolds what the dialog shows while open, scrolling when the content is tall.
DialogTitleDialogTitle.vueNames the dialog.
DialogTriggerDialogTrigger.vueOpens the dialog.

Anatomy

<Dialog>
  <DialogTrigger />
  <DialogContent>
    <DialogHeader>
      <DialogTitle />
      <DialogDescription />
    </DialogHeader>
    <DialogBody />
    <DialogFooter>
      <DialogClose />
    </DialogFooter>
  </DialogContent>
</Dialog>

Styling

All of Dialog’s styles live in dialog.json. New to styling in Frontic UI? How styling works →

Install

Installs with it
button
focus
npm packages
@lucide/vue
@vueuse/core
class-variance-authority
reka-ui

Built from

API reference

Dialog.vue

Groups all parts of the dialog.

Props 4

PropTypeDefault
openboolean—
defaultOpenbooleanfalse
modalbooleantrue
unmountOnHidebooleantrue

Events 1

EventPayload
update:openvalue: boolean

Slots 1

SlotSlot props
default{ open: boolean; close: () => void; }

DialogBody.vue

DialogClose.vue

DialogContent.vue

DialogDescription.vue

DialogFooter.vue

DialogHeader.vue

DialogOverlay.vue

DialogScrollContent.vue

DialogTitle.vue

DialogTrigger.vue
Dialog

Size guide

1<!-- SPDX-License-Identifier: FSL-1.1-MIT AND MIT -->2<!-- Frontic UI © Frontic · Portions © 2023 unovue (shadcn-vue, MIT) · ui.frontic.com/license -->3<script setup lang="ts">4import { Button } from '@/components/ui/button'5import {6  Item,7  ItemContent,8  ItemDescription,9  ItemGroup,10  ItemTitle,11} from '@/components/ui/item'12import {13  Table,14  TableBody,15  TableCaption,16  TableCell,17  TableHead,18  TableHeader,19  TableRow,20} from '@/components/ui/table'21import {22  Dialog,23  DialogClose,24  DialogDescription,25  DialogFooter,26  DialogHeader,27  DialogScrollContent,28  DialogTitle,29  DialogTrigger,30} from '@/components/ui/dialog'31 32const sizes = [33  { size: 'XS', chest: '82–86', waist: '66–70', sleeve: 60 },34  { size: 'S', chest: '87–92', waist: '71–76', sleeve: 61 },35  { size: 'M', chest: '93–100', waist: '77–84', sleeve: 62 },36  { size: 'L', chest: '101–108', waist: '85–92', sleeve: 63 },37  { size: 'XL', chest: '109–116', waist: '93–100', sleeve: 64 },38  { size: 'XXL', chest: '117–124', waist: '101–108', sleeve: 65 },39]40 41const notes = [42  {43    term: 'Chest',44    detail: 'Under your arms, around the fullest part, tape level at the back.',45  },46  {47    term: 'Waist',48    detail: 'Around the narrowest part of your torso, snug but not tight.',49  },50  {51    term: 'Sleeve',52    detail: 'From the back of your neck, over the shoulder, down to the wrist.',53  },54]55</script>56 57<template>58  <Dialog default-open>59    <DialogTrigger as-child60      ><Button variant="outline" color="neutral"61        >Size guide</Button62      ></DialogTrigger63    >64    <DialogScrollContent>65      <DialogHeader>66        <DialogTitle>Size guide</DialogTitle>67        <DialogDescription68          >Jackets fit true to size. Between two sizes, take the larger one to69          wear a fleece underneath.</DialogDescription70        >71      </DialogHeader>72      <Table>73        <TableCaption>Body measurements in centimetres.</TableCaption>74        <TableHeader>75          <TableRow>76            <TableHead>Size</TableHead>77            <TableHead class="text-end">Chest</TableHead>78            <TableHead class="text-end">Waist</TableHead>79            <TableHead class="text-end">Sleeve</TableHead>80          </TableRow>81        </TableHeader>82        <TableBody>83          <TableRow v-for="row in sizes" :key="row.size">84            <TableCell>{{ row.size }}</TableCell>85            <TableCell class="text-end">{{ row.chest }}</TableCell>86            <TableCell class="text-end">{{ row.waist }}</TableCell>87            <TableCell class="text-end">{{ row.sleeve }}</TableCell>88          </TableRow>89        </TableBody>90      </Table>91      <ItemGroup aria-label="How to measure">92        <Item v-for="note in notes" :key="note.term" size="sm">93          <ItemContent>94            <ItemTitle>{{ note.term }}</ItemTitle>95            <ItemDescription>{{ note.detail }}</ItemDescription>96          </ItemContent>97        </Item>98      </ItemGroup>99      <DialogFooter>100        <DialogClose as-child><Button>Got it</Button></DialogClose>101      </DialogFooter>102    </DialogScrollContent>103  </Dialog>104</template>