Skip to content
This is a draft component and subject to change!

Dialog

Dialogs interrupt users with urgent information, details, or actions. They appear in response to an action the user has performed.

Interactive demo

The demo below allows you to preview the component. You can play with its props, variations, configuration options and dive into its events and even see them trigger in the event log tab.

MedKit Dialog
Icon
Icon
tick
The icon for the dialog
Icon Background
string
The background colour of the icon
Title
string
Required
The primary title for the modal
Text
string
The primary text description for the user
Persistent
boolean
false
Defines if the modal can be closed by clicking outside the modal
Destructive
boolean
false
Defines if the modal represents a destructive action
Is Loading
boolean
false
Changes the dialog to a loading state

Dialog Example

A dialog is an opinionated version of a modal.

vue
<template>
  <DocExample>
    <MedKitButton label="Open Dialog" @click="dialog = true" />
    <MedKitDialog v-model="dialog" title="Title" text="Lorem ipsum dolor sit amet, consectetur adipiscing eli.">
      <MedKitButton label="Primary Action" kind="primary" @click="dialog = false" />
      <MedKitButton label="Secondary Action" kind="secondary" @click="dialog = false" />
      <MedKitButton label="Cancel" kind="tertiary" @click="dialog = false" />
    </MedKitDialog>
  </DocExample>
</template>

Destructive Dialog

vue
<template>
  <DocExample>
    <MedKitButton label="Open Dialog" @click="dialog = true" />
    <MedKitDialog v-model="dialog" destructive title="Delete draft?" icon="delete">
      <template #text>
        <p>This action cannot be undone.</p>
        <p>Are you sure you want to continue?</p>
      </template>
      <MedKitButton label="Destructive Action" kind="primary:destructive" @click="dialog = false" />
      <MedKitButton label="Secondary Action" kind="secondary" @click="dialog = false" />
      <MedKitButton label="Cancel" kind="tertiary" @click="dialog = false" />
    </MedKitDialog>
  </DocExample>
</template>

Loading State

vue
<template>
  <DocExample>
    <MedKitButton label="Open Dialog" @click="dialog = true" />
    <MedKitDialog v-model="dialog" isLoading title="Processing" text="Please do not refresh or close your browser.">
      <MedKitButton label="Close" kind="tertiary" @click="dialog = false" />
    </MedKitDialog>
  </DocExample>
</template>