Modal
A blocking dialog for a decision the page cannot continue without.
Default
Bind open state with v-model:active. active and open are aliases.
1
<Button size="small" @click="open = true">Open Modal</Button>
3
<Modal v-model:active="open">
4
<ModalBody>
5
<ModalHeader>
6
<ModalTitle>Create Token</ModalTitle>
7
<ModalSubtitle>
8
Enter a unique name so you can tell this token apart later.
9
</ModalSubtitle>
10
</ModalHeader>
11
<Input v-model="tokenName" size="small" label="Token Name" placeholder="ci-deploy" />
12
</ModalBody>
13
<ModalActions>
14
<ModalAction variant="secondary" @click="open = false">Cancel</ModalAction>
15
<ModalAction @click="open = false">Create Token</ModalAction>
16
</ModalActions>
17
</Modal>
Sticky
sticky pins the header and actions while ModalBody scrolls. Use it when the copy is longer than the viewport.
1
<Modal v-model:active="open" sticky>
2
<ModalBody>
3
<ModalHeader>
4
<ModalTitle>Create Token</ModalTitle>
5
</ModalHeader>
6
<!-- long body -->
7
</ModalBody>
8
<ModalActions>
9
<ModalAction variant="secondary" @click="open = false">Cancel</ModalAction>
10
<ModalAction @click="open = false">Create Token</ModalAction>
11
</ModalActions>
12
</Modal>
Inset
ModalInset is a recessed band for a field or a preview. last drops the bottom border when it sits on the actions.
Disabled and full width
Disable the primary until the form is valid. full-width stretches a single acknowledgment action.
Initial focus
initial-focus-ref moves first focus onto a control. Pass a component instance or an HTMLElement.
Best practices
- Modal blocks the page. Persistent side context is a Sheet or Drawer. A dedicated create flow is a route, not a dialog.
- Title is Title Case and a statement:
Create Token, never a question. The primary button repeats that verb and noun. - Cancel stays the literal word Cancel. Acknowledgment-only dialogs use Done. Do not label either Close or OK.
- Destructive confirms stay in a Modal. Default focus to Cancel so Enter cannot fire the delete.
- Escape and outside click may dismiss a safe form. Gate them when the body has unsaved or irreversible input.