Help guide

Modal Toggle node

Updated June 21, 2026

Modal Toggle node

Product media placeholder

Replace this area with a screenshot or short walkthrough video during the media sweep.

Open-on-click / close-on-click toggle that latches a 0/1 state and writes it to one or more `data-*` attributes. Compound: expanded into eventListener + pulseOr + latch + domPropertyWrite per open target. Each `openTarget` receives the same attribute write so popup / trigger / backdrop / overlay all flip in sync.

Type modalToggleCategory inputsContext sharedDynamic ports noCompound yes

Inputs

PortTypeDescription
--No ports declared.

Outputs

PortTypeDescription
--No ports declared.

Parameters

ParameterTypeDefaultDescription
openTriggersselectorList[]CSS selectors that fire the open pulse on click. Each row is one selector — add as many as you need (up to 4). Each is bound an event listener; firing latches state to 1.
closeTriggersselectorList[]CSS selectors that fire the close pulse on click. Common: a close button (`.modal-close`) and a backdrop click-out target (`.modal-backdrop`). Leave empty for an open-only one-way latch.
openTargetsselectorList[]CSS selectors that receive the `openAttribute` write. The popup itself, the trigger button (so it can highlight), and any backdrop / body lock element are typical entries. All flip together.
openAttributestring"data-open"HTML attribute written to each `openTarget`. Default `data-open`. Use `data-active`, `data-state`, `aria-expanded` or any custom attribute your CSS reads.
openEventdomEvent"click"DOM event name for the open triggers. Default `click`. Use `mouseenter` for hover-open, `focus` for keyboard-open, etc.
closeEventdomEvent"click"DOM event name for the close triggers. Default `click`. Useful as `mouseleave` paired with `mouseenter` on open.
cssVarWritesstring[]Optional list of `{target, name}` pairs. Each emits an additional unitless write of the 0/1 latch state to a CSS custom property (e.g. `--menu-open`). Use when CSS animations are driven by `var(--x)` instead of (or in addition to) the data-attribute selector. Edit as raw JSON for now: `[{"target":".ds-page","name":"--menu-open"}]`.

Use cases

  • Modal / drawer open-close — `openTriggers: [".btn-open"]`, `closeTriggers: [".close-x", ".backdrop"]`. Each click on the open trigger sets `data-open=1` on every `openTarget`; each click on a close trigger resets to 0. Pair with a CSS `[data-open="1"]` rule for visibility / clip-path animation.
  • Dropdown menu open-close — same shape, smaller scope. Common pattern in nav menus, account dropdowns, language switchers.
  • Mobile hamburger overlay — `openTriggers: [".hamburger"]`, `closeTriggers: [".overlay-backdrop"]`, `openTargets: [".overlay", ".hamburger", "body"]`. The body write lets CSS lock scroll while open.
  • Popover / tooltip on click — for click-toggled popovers, the same 0/1 latch pattern fits.

Related nodes

Envelope

Use modalToggle as the node type inside a graph node envelope. Add id, optional params, optional connections, and optional activeWhen based on the guide context.

Generated source

Registry faster-motion-docs/node-registry.jsonCategory page /help/faster-motion/faster-motion-node-category-inputs/

Was this guide helpful?

Sunny Arora

Written by

Sunny Arora

Get technical deep dives delivered to your inbox

Join creators and developers who get exclusive insights, tutorials, and behind-the-scenes content every week.

No spam. Unsubscribe anytime.

Continue Exploring

You might also enjoy