Skip to main content
VelinStyle v1.3.0
⌂ Home
  1. Docs
  2. Components
  3. Overlays
  4. Modal

Modal 1.2.2

<velin-modal> is a centered dialog overlay with header, body, and optional footer slot. In 1.2.0, open/close lifecycle uses focus-manager for background inert and body scroll lock. Deutsch: Modal De

Maturity: Documented as stable in VelinStyle 1.2.0. Design Intelligence (plan / review / agent meta) is separate and beta / foundation where noted.

When to use

When not

Basic modal

Open with open() or the open attribute. Set the visible title with title (HTML-escaped). Default slot is the body; use slot="footer" for actions.

This is a basic modal with a title and body content.

<button type="button" class="velin-btn velin-btn--primary"
        onclick="document.getElementById('myModal').open()">
  Open Modal
</button>

<velin-modal id="myModal" title="Modal title">
  <p>This is a basic modal body.</p>
  <button type="button" class="velin-btn velin-btn--primary" slot="footer"
          onclick="document.getElementById('myModal').close()">Done</button>
</velin-modal>

Place action buttons in the named footer slot. They render in the dialog footer bar.

<velin-modal id="confirmUi" title="Save changes?">
  <p>Unsaved edits will be lost if you leave.</p>
  <button type="button" class="velin-btn velin-btn--outline" slot="footer"
          onclick="this.closest('velin-modal').close()">Cancel</button>
  <button type="button" class="velin-btn velin-btn--primary" slot="footer">Save</button>
</velin-modal>

Accessibility

Dark, responsive, motion, RTL

API

Attributes

AttributeTypeDescription
openBooleanObserved — presence opens the modal
titleStringHeader title (escaped); drives aria-labelledby when set
aria-labelStringFallback name when title is empty

Slots & parts

NameKindDescription
(default)SlotModal body
footerSlotFooter actions
overlay, dialog, header, body, footer, closeCSS partsShadow styling hooks

Methods & events

APIDescription
open()Sets open
close()Removes open; dispatches velin-close (bubbles)
velin-closeFired from close()

CSS variables

VariableRole
--velin-z-modalOverlay z-index (default 500)
--velin-color-overlayBackdrop
--velin-color-surface-brightDialog background
--velin-radius-lgDialog radius
--velin-shadow-xlDialog shadow

Best practices & pitfalls