ModalTrigger
ModalTriggerDialog action A clear invitation to a focused task. Connect a labelled native button to a matching dialog.
Layout & contentIn context
Release review
Open a focused review without leaving your place in the document.
The target matches the dialog ID. Multiple triggers can open the same dialog and retain their own appearance.
<div class="component-recipe">
<h3>Release review</h3>
<p>Open a focused review without leaving your place in the document.</p>
<Flex wrap="true">
<ModalTrigger target="layout-trigger-review" label="Review release" tone="accent"/>
<ModalTrigger target="layout-trigger-review" label="Preview again" tone="neutral" variant="outline"/>
</Flex>
<Modal id="layout-trigger-review" title="Review release" :showClose="true">
<p>This dialog belongs to both triggers. Close it to return focus to the button you used.</p>
<template #footer>
<Btn tone="accent" data-modal-close>Done</Btn>
</template>
</Modal>
</div> Open a review dialog
The target is the dialog ID without a hash. Close returns focus to the trigger.
<ModalTrigger target="trigger-review-dialog" label="Review release" tone="accent" />
<Modal id="trigger-review-dialog" title="Review release" size="sm" :showClose="true">
<p>The example release is ready for review.</p>
<template #footer>
<Btn data-modal-close variant="outline">Close review</Btn>
</template>
</Modal> A secondary trigger
More than one trigger can open the same dialog; each has its own label and treatment.
<ModalTrigger
target="trigger-review-dialog"
label="Open the same review"
tone="neutral"
variant="outline"
/> All semantic tones
All ten supported tones. A semantic palette communicates intent; visible labels keep the meaning explicit.
neutral accent feature secondary custom ghost info success warning danger Every value is visible. Compare treatments in the site’s light and dark themes.
All visual variants
All eighteen supported treatments, shown together.
solid surface surfaceAlt spotlight glass flat flatAlt flatSolid outlineFill outline subtle subtleBtn link sheen underline rail bracket none Every value is visible. Compare treatments in the site’s light and dark themes.
Behavior and accessibility
ModalTrigger renders a native button. Enter and Space activate it. The standard modal runtime opens the target dialog, manages focus and handles Escape. A matching Modal must exist in the page.
API reference
ModalTrigger contract
Props below are the public template API. RefOrValue accepts a literal or a reactive ref; bind refs with a colon-prefixed attribute. Native attributes and events can be passed through the component root.
target
string - Default
not set
ID of the target Modal, without #. This is not an anchor href.
label
RefOrValue<string> - Default
not set
Visible label. Use language that describes the control or value in its surrounding context.
tone
RefOrValue<SemanticTone> - Default
inherited
Semantic intent: neutral, accent, secondary, info, success, warning, danger, feature, custom or ghost. The active skin supplies the colors.
variant
RefOrValue<ComponentVariant> - Default
solid
Visual treatment. Accepts solid, surface, surfaceAlt, spotlight, glass, flat, flatAlt, flatSolid, outlineFill, outline, subtle, subtleBtn, link, sheen, underline, rail, bracket or none.
Composition
No slots. label supplies the text. Register defineModalComponents and defineButtonComponents. SSG includes the modal runtime when Modal is rendered.