Skip to content

Modal ​

Terminal-style modal dialog with overlay, header, body, footer, and keyboard support.

Modal

Design lines ​

vue
1<script setup>2import { ref } from 'vue'34const openRubik = ref(false)5</script>67<Button @click="openRubik = true" color="primary">Open rubik modal</Button>8<Modal v-model:open="openRubik" title="Rubik modal" design="rubik">9  Cut corners, ink bars, HUD restraint.10</Modal>

Demo ​

Open & title ​

How the modal is opened and titled: the open model and the title prop.

Basic (open + title) ​

Minimal modal: open controls visibility and title sets the header text.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'4const isOpen = ref(false)5</script>67<template>8  <Button @click="isOpen = true" color="primary">Open modal</Button>9  <Modal v-model:open="isOpen" title="Example Modal" closable>10    This is the modal body content.11    <template #footer>12      <Button @click="isOpen = false">OK</Button>13      <Button @click="isOpen = false">Cancel</Button>14    </template>15  </Modal>16</template>

Title (title) ​

Plain-text heading rendered in the modal header.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'4const openTitle = ref(false)5</script>67<template>8  <Button @click="openTitle = true" color="primary">Open modal</Button>9  <Modal v-model:open="openTitle" title="Modal with title" closable>10    Modal content.11    <template #footer>12      <Button @click="openTitle = false">Close</Button>13    </template>14  </Modal>15</template>

Title (title slot) ​

Rich content that replaces the plain title prop in the header. The slot wins when both are provided.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'45const openTitleSlot = ref(false)6</script>78<template>9  <Button @click="openTitleSlot = true" color="primary">Open modal</Button>10  <Modal v-model:open="openTitleSlot" title="Prop fallback" closable>11    <template #title><span style="color:var(--accent)">★</span> Slotted title</template>12    Modal body.13  </Modal>14</template>

Appearance ​

The props that change the modal's look: color and width.

Color (color) ​

Semantic color applied to the modal title in the header.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'4const openColorP = ref(false)5const openColorS = ref(false)6const openColorD = ref(false)7</script>89<template>10  <div style="display: flex; gap: 0.5rem;">11    <Button @click="openColorP = true" color="primary">Primary</Button>12    <Button @click="openColorS = true" color="success">Success</Button>13    <Button @click="openColorD = true" color="danger">Danger</Button>14  </div>15  <Modal v-model:open="openColorP" title="Primary" color="primary" closable>16    Modal with primary color.17    <template #footer>18      <Button @click="openColorP = false" color="primary">Close</Button>19    </template>20  </Modal>21  <Modal v-model:open="openColorS" title="Success" color="success" closable>22    Modal with success color.23    <template #footer>24      <Button @click="openColorS = false" color="success">Close</Button>25    </template>26  </Modal>27  <Modal v-model:open="openColorD" title="Danger" color="danger" closable>28    Modal with danger color.29    <template #footer>30      <Button @click="openColorD = false" color="danger">Close</Button>31    </template>32  </Modal>33</template>

Width (width) ​

Width of the modal, set with any CSS unit such as ch.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'4const openWidthNarrow = ref(false)5const openWidthWide = ref(false)6</script>78<template>9  <div style="display: flex; gap: 0.5rem;">10    <Button @click="openWidthNarrow = true" color="primary">40ch</Button>11    <Button @click="openWidthWide = true" color="primary">80ch</Button>12  </div>13  <Modal v-model:open="openWidthNarrow" title="Narrow (40ch)" width="40ch" closable>14    Modal content with 40ch width.15    <template #footer>16      <Button @click="openWidthNarrow = false" color="primary">Close</Button>17    </template>18  </Modal>19  <Modal v-model:open="openWidthWide" title="Wide (80ch)" width="80ch" closable>20    Modal content with 80ch width.21    <template #footer>22      <Button @click="openWidthWide = false" color="primary">Close</Button>23    </template>24  </Modal>25</template>

Closable (closable) ​

Shows or hides the close button (×) in the header.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'4const openClosableOn = ref(false)5const openClosableOff = ref(false)6</script>78<template>9  <div style="display: flex; gap: 0.5rem;">10    <Button @click="openClosableOn = true" color="primary">With close</Button>11    <Button @click="openClosableOff = true" color="primary">Without close</Button>12  </div>13  <Modal v-model:open="openClosableOn" title="Closable" closable>14    You can close with ×, Escape or the button below.15    <template #footer>16      <Button @click="openClosableOn = false" color="primary">Close</Button>17    </template>18  </Modal>19  <Modal v-model:open="openClosableOff" title="Not closable" :closable="false">20    You can only close with Escape or the button below.21    <template #footer>22      <Button @click="openClosableOff = false" color="primary">Close</Button>23    </template>24  </Modal>25</template>

The two slots that fill the modal body and its action area.

Body (default slot) ​

Main content of the modal. Can include any HTML or Vue component.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'4const openContent = ref(false)5</script>67<template>8  <Button @click="openContent = true" color="primary">Open modal</Button>9  <Modal v-model:open="openContent" title="Varied content" closable>10    <p>This is the modal body.</p>11    <ul>12      <li>Item 1</li>13      <li>Item 2</li>14      <li>Item 3</li>15    </ul>16    <template #footer>17      <Button @click="openContent = false" color="primary">OK</Button>18    </template>19  </Modal>20</template>

Action area of the modal. Typically contains confirmation or cancellation buttons.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'4const openFooter = ref(false)5</script>67<template>8  <Button @click="openFooter = true" color="primary">Open modal</Button>9  <Modal v-model:open="openFooter" title="Confirmation" closable>10    Are you sure you want to perform this action?11    <template #footer>12      <Button @click="openFooter = false" color="primary">Cancel</Button>13      <Button @click="openFooter = false" color="primary">Confirm</Button>14    </template>15  </Modal>16</template>

Plain-text footer content via the footer prop. The slot wins if both are provided.

vue
1<script setup lang="ts">2import { ref } from 'vue'3import { Button, Modal } from '@dowardev/herdrate-vue'4const openFooterProp = ref(false)5</script>67<template>8  <Button @click="openFooterProp = true" color="primary">Open modal</Button>9  <Modal v-model:open="openFooterProp" title="Footer prop" footer="Press Esc to close" closable>10    Modal body.11  </Modal>12</template>

Props ​

open ​

Controls the open state of the modal (use with v-model:open / update:open).

TypeDefaultRequired
booleanfalse❌

title ​

Title shown in the modal header. When empty, no reserved space is shown.

TypeDefaultRequired
string''❌

color ​

Semantic color of the title in the header.

TypeDefaultRequired
Color'primary'❌

width ​

Width of the modal. Accepts any CSS value: ch, px, rem, %.

TypeDefaultRequired
string'60ch'❌

closable ​

Shows or hides the close button (×) in the header.

TypeDefaultRequired
booleantrue❌

Plain-text footer content shown at the bottom of the modal. Overridden by the footer slot if provided.

TypeDefaultRequired
string—❌

design ​

Design line (or inherit from data-design).

TypeDefaultRequired
'tuix' | 'rubik'— (inherits from data-design)❌

Events ​

EventPayloadDescription
update:openbooleanEmitted when the modal requests to open or close (use with v-model:open).
closevoidEmitted when the close button is clicked or Escape is pressed.

Slots ​

SlotDescription
defaultModal body, accepts any HTML or Vue component
titleReplaces the title prop with rich content (icons, components, etc.)
footerAction area, typically confirmation or cancellation buttons

CSS Custom Properties ​

TokenDefaultDescription
--font-mono"JetBrains Mono", ui-monospace, monospaceMonospace font stack for code-like content (key labels, log lines, chips).
--accentfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Accent color, mapped from the active semantic color.
--bgfrom theme (--ctp-latte-base / --ctp-mocha-base)Base background of the surface.
--bg-panelfrom theme (--ctp-latte-surface1 / --ctp-mocha-surface1)Background of panel-like raised surfaces (cards, accordions).
--borderfrom theme (--ctp-latte-surface0 / --ctp-mocha-surface0)Outline and divider color for surfaces.
--textfrom theme (--ctp-latte-text / --ctp-mocha-text)Primary text color used inside the component.
--color-primaryfrom theme (--ctp-latte-mauve / --ctp-mocha-mauve)Primary semantic color (mauve in Catppuccin).
--color-secondaryfrom theme (--ctp-latte-lavender / --ctp-mocha-lavender)Secondary semantic color (lavender in Catppuccin).
--color-tertiaryfrom theme (--ctp-latte-blue / --ctp-mocha-blue)Tertiary semantic color (blue in Catppuccin).
--color-successfrom theme (--ctp-latte-green / --ctp-mocha-green)Success semantic color (green in Catppuccin).
--color-warningfrom theme (--ctp-latte-yellow / --ctp-mocha-yellow)Warning semantic color (yellow in Catppuccin).
--color-dangerfrom theme (--ctp-latte-red / --ctp-mocha-red)Danger semantic color (red in Catppuccin).
--color-lightfrom theme (--ctp-latte-surface1 / --ctp-mocha-rosewater)Light semantic color (lighter contrast tone).
--color-mediumfrom theme (--ctp-latte-overlay0 / --ctp-mocha-overlay2)Medium semantic color (mid-tone).
--color-darkfrom theme (--ctp-latte-text / --ctp-mocha-subtext1)Dark semantic color (high contrast text).
--cp-easecubic-bezier(.4, 0, .2, 1)Default easing curve for transitions.
--shadownone on TUIX, elevated on rubikElevation shadow for raised surfaces.

Ver Theming para la convención completa.