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
modelValueboolean—Controls visibility (v-model)
size'small' | 'medium' | 'large' | 'full''medium'Dialog size
positionstring—Dialog position on screen
widthstring—Custom width override
heightstring—Custom 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
zIndexnumber—Custom z-index

Events ​

EventPayloadDescription
update:modelValuebooleanVisibility change

Slots ​

SlotBindingsDescription
header—Dialog header/title content
body—Main dialog content
footer—Footer 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