// Generated by scripts/generate-showcase.mjs. Do not edit directly. page ModalDetail { layout = "showcase" state playground_open = (ctx.url.searchParams.get("pg_open") ?? "false") === "true" state playground_defaultOpen = (ctx.url.searchParams.get("pg_defaultOpen") ?? "false") === "true" state playground_title = ctx.url.searchParams.get("pg_title") ?? "Modal playground" state playground_description = ctx.url.searchParams.get("pg_description") ?? "A polished default modal for a modern application." state playground_icon = ctx.url.searchParams.get("pg_icon") ?? "" state playground_label = ctx.url.searchParams.get("pg_label") ?? "Modal" state playground_size = ctx.url.searchParams.get("pg_size") ?? "md" state playground_placement = ctx.url.searchParams.get("pg_placement") ?? "center" state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary" state playground_variant = ctx.url.searchParams.get("pg_variant") ?? "default" state playground_showClose = (ctx.url.searchParams.get("pg_showClose") ?? "true") === "true" state playground_closeLabel = ctx.url.searchParams.get("pg_closeLabel") ?? "Modal" state playground_closeOnBackdrop = (ctx.url.searchParams.get("pg_closeOnBackdrop") ?? "true") === "true" state playground_closeOnEscape = (ctx.url.searchParams.get("pg_closeOnEscape") ?? "true") === "true" state playground_closeOnCancel = (ctx.url.searchParams.get("pg_closeOnCancel") ?? "true") === "true" state playground_closeOnConfirm = (ctx.url.searchParams.get("pg_closeOnConfirm") ?? "false") === "true" state playground_showFooter = (ctx.url.searchParams.get("pg_showFooter") ?? "true") === "true" state playground_cancelLabel = ctx.url.searchParams.get("pg_cancelLabel") ?? "Modal" state playground_cancelIcon = ctx.url.searchParams.get("pg_cancelIcon") ?? "" state playground_confirmLabel = ctx.url.searchParams.get("pg_confirmLabel") ?? "Modal" state playground_confirmIcon = ctx.url.searchParams.get("pg_confirmIcon") ?? "" state playground_confirmDisabled = (ctx.url.searchParams.get("pg_confirmDisabled") ?? "false") === "true" state playground_confirmLoading = (ctx.url.searchParams.get("pg_confirmLoading") ?? "false") === "true" state playground_destructive = (ctx.url.searchParams.get("pg_destructive") ?? "false") === "true" state playground_triggerLabel = ctx.url.searchParams.get("pg_triggerLabel") ?? "Open playground modal" state playground_triggerIcon = ctx.url.searchParams.get("pg_triggerIcon") ?? "" state playground_scrollable = (ctx.url.searchParams.get("pg_scrollable") ?? "true") === "true" state playground_scrollBehavior = ctx.url.searchParams.get("pg_scrollBehavior") ?? "inside" state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1" seo { title = "Modal" description = "Present an accessible modal dialog with focus management, confirmation, cancellation, slots, and responsive sizing." } view {
Overlays component

Modal

Present an accessible modal dialog with focus management, confirmation, cancellation, slots, and responsive sizing.

29 props4 slots4 outputsTheme readyResponsive
Interactive playground

Configure Modal

Change any prop and inspect the server-rendered component immediately.

Live preview

This request will be submitted for review.

Component code
<Modal
  title="Modal example"
  description="A polished default modal for a modern application."
  label="Modal"
  closeLabel="Modal"
  cancelLabel="Modal"
  confirmLabel="Modal"
  triggerLabel="Modal">
  <div data-slot="trigger">
    <div class="showcase-slot">trigger slot</div>
  </div>
  <div data-slot="header">
    <div class="showcase-slot">header slot</div>
  </div>
  <div data-slot="footer">
    <div class="showcase-slot">footer slot</div>
  </div>
</Modal>
Event outputInteract with the preview to inspect the typed payload.
Component props29 controls
Live examples

Designed for real product surfaces

Compare configurations and resize the browser to check responsive behavior.

Recommended

Confirmation modal

Focus the user on one clear decision with confirm and cancel actions.

01
Component usage.wrn
<Modal
  title="Confirm service request"
  description="Review the information before continuing."
  icon="icon-[lucide--shield-check]"
  label="Modal"
  closeLabel="Modal"
  cancelLabel="Go back"
  confirmLabel="Confirm request"
  confirmIcon="icon-[lucide--check]"
  triggerLabel="Open modal"
  triggerIcon="icon-[lucide--square-stack]">
  <div data-slot="trigger">
    <div class="showcase-slot">trigger slot</div>
  </div>
  <div data-slot="header">
    <div class="showcase-slot">header slot</div>
  </div>
  <div class="showcase-overlay-content"><p>This request will be submitted for review.</p></div>
  <div data-slot="footer">
    <div class="showcase-slot">footer slot</div>
  </div>
</Modal>
Compact

Destructive confirmation

Use a danger treatment for irreversible operations.

02
Component usage.wrn
<Modal
  title="Delete this record?"
  description="This action cannot be undone."
  icon="icon-[lucide--arrow-right]"
  label="Compact example"
  size="sm"
  variant="outline"
  closeLabel="Compact example"
  cancelLabel="Keep record"
  confirmLabel="Delete record"
  destructive="true"
  triggerLabel="Delete record">
  <div data-slot="trigger">
    <div class="showcase-slot">trigger slot</div>
  </div>
  <div data-slot="header">
    <div class="showcase-slot">header slot</div>
  </div>
  <div data-slot="footer">
    <div class="showcase-slot">footer slot</div>
  </div>
</Modal>
Advanced

Scrollable form modal

Open a larger modal for focused forms while keeping actions visible.

03
Component usage.wrn
<Modal
  title="Create service request"
  description="Complete the required information."
  icon="icon-[lucide--trash-2]"
  label="Advanced example"
  size="lg"
  variant="soft"
  closeLabel="Advanced example"
  cancelLabel="Advanced example"
  confirmLabel="Submit request"
  triggerLabel="Open request form"
  triggerIcon="icon-[lucide--file-plus-2]">
  <div data-slot="trigger">
    <div class="showcase-slot">trigger slot</div>
  </div>
  <div data-slot="header">
    <div class="showcase-slot">header slot</div>
  </div>
  <div class="showcase-overlay-content showcase-overlay-content--tall"><label>Request title<input value="Sample request" /></label><label>Description<textarea>Supporting information</textarea></label></div>
  <div data-slot="footer">
    <div class="showcase-slot">footer slot</div>
  </div>
</Modal>
Component outputs

Receive every typed component output

Use declarative output handlers in .wrn files or register a direct output handler from JavaScript. The canonical API exposes payload and does not require event.detail.

@openFires after the component opens.
@closeFires after the component closes.
@cancelFires when the user cancels or dismisses the current workflow.
@confirmFires when the user confirms the current action.
Declarative handlers.wrn
<Modal
  @open='console.log(payload)'
  @close='console.log(payload)'
  @cancel='console.log(payload)'
  @confirm='console.log(payload)'
/>
Direct output handlers.js
import { registerOutputHandler } from "@wrnexus/csr/outputs"

const component = document.querySelector("[data-ui-component=\"Modal\"], [data-component=\"Modal\"]")

if (component) registerOutputHandler(component, "open", (payload) => {
  console.log("open", payload)
})

if (component) registerOutputHandler(component, "close", (payload) => {
  console.log("close", payload)
})

if (component) registerOutputHandler(component, "cancel", (payload) => {
  console.log("cancel", payload)
})

if (component) registerOutputHandler(component, "confirm", (payload) => {
  console.log("confirm", payload)
})
Component API

Props and configuration

All content and behavior shown above is supplied through these props and slots.

PropTypeDefaultRequired
openbooleanfalseNo
defaultOpenbooleanfalseNo
titlestring"Modal"No
descriptionstring""No
iconstring""No
labelstring"Modal dialog"No
sizestring"md"No
placementstring"center"No
colorstring"primary"No
variantstring"default"No
showClosebooleantrueNo
closeLabelstring"Close modal"No
closeOnBackdropbooleantrueNo
closeOnEscapebooleantrueNo
closeOnCancelbooleantrueNo
closeOnConfirmbooleanfalseNo
showFooterbooleantrueNo
cancelLabelstring"Cancel"No
cancelIconstring""No
confirmLabelstring"Confirm"No
confirmIconstring""No
confirmDisabledbooleanfalseNo
confirmLoadingbooleanfalseNo
destructivebooleanfalseNo
triggerLabelstring""No
triggerIconstring""No
scrollablebooleantrueNo
scrollBehaviorstring"inside"No
classstring""No
} }