Skip to content

Dialog

Modal overlay for focused interactions — confirmations, forms, or detailed content that requires attention.

Open in Storybook

Interactive Demo

Usage

vue
<script setup>
import { ref } from 'vue';
import { Dialog, Button } from '@yellowcard/b2b-design-system';

const open = ref(false);
</script>

<template>
  <Button label="Open Dialog" @click="open = true" />

  <Dialog v-model="open" size="medium">
    <template #header>Confirm Action</template>
    <template #body>
      <p>Are you sure you want to proceed?</p>
    </template>
    <template #footer>
      <Button label="Cancel" hierarchy="secondary-grey" @click="open = false" />
      <Button label="Confirm" hierarchy="primary" @click="open = false" />
    </template>
  </Dialog>
</template>

API Reference

Props

PropTypeDefaultDescription
modelValuebooleanControls visibility (v-model)
size'small' | 'medium' | 'large' | 'full''medium'Dialog size
positionstringDialog position on screen
widthstringCustom width override
heightstringCustom height override
dismissiblebooleantrueShow close button
closeOnOverlaybooleantrueClose when clicking overlay
closeOnEscapebooleantrueClose on Escape key
trapFocusbooleantrueTrap focus within dialog
persistentbooleanfalsePrevent dismissal (requires explicit close)
loadingbooleanfalseShow loading overlay
zIndexnumberCustom z-index

Events

EventPayloadDescription
update:modelValuebooleanVisibility change

Slots

SlotBindingsDescription
headerDialog header/title content
bodyMain dialog content
footerFooter with actions

Accessibility

  • Uses role="dialog" with aria-modal="true"
  • Focus is trapped within the dialog
  • Escape key closes the dialog (unless persistent)
  • Focus returns to trigger element on close