crucıble

Aperture

A trigger button that irises open in place into a compact form — one continuous surface through invite, input, pending, and confirmation. Measured FLIP with radius continuity, fields fading up after the frame lands; while async onSubmit is in flight a thin conic arc sweeps the submit control, then the surface exhales into a confirmation chip and returns to rest. Real form semantics, full focus trap, Escape and outside-click reverse the morph, reduced-motion crossfades.

motionpro

Installation

CLI

npx shadcn@latest add @crucible/aperture

Manual — install dependencies, then copy the source

npm install motion

Props

PropTypeDefaultDescription
triggerReact.ReactNode"Feedback"Content of the resting trigger button.
childrenReact.ReactNodeForm contents rendered inside the open surface. Omit for the built-in single-field + submit preset. Custom children should include an <ApertureSubmit> so the pending iris has a control to sweep.
openbooleanControlled open state of the form. Omit for uncontrolled use.
defaultOpenbooleanfalseInitial open state in uncontrolled mode.
onOpenChange(open: boolean) => voidFires whenever the form asks to open or close (trigger click, Escape, outside click, submit).
onSubmit(data: FormData, event: React.FormEvent<HTMLFormElement>) => void | Promise<void>Called on submit with the form's FormData (the preset field is named "message"). Return a promise to drive the pending iris — resolve morphs to the confirmation chip, reject keeps the form open for retry.
spring{ stiffness?: number; damping?: number; mass?: number }{ stiffness: 340, damping: 32, mass: 0.9 }Morph spring overrides, merged over the default.
successContentReact.ReactNodea drawn check + "Thank you"Confirmation chip content after a successful submit.
autoReturnDelaynumber | null2200Milliseconds the confirmation chip rests before morphing back to the button. Pass null to disable auto-return (Escape or an outside click still dismisses the chip).
directionApertureDirection"centered"Growth direction of the surface from the trigger.
openWidthnumber320Width of the open form in px.
openHeightnumberFixed height of the open form in px. Omit for auto height.
accentstring"#a5b4fc"Accent hex — used on the submit control and focus rings only.
fieldLabelstring"Your message"Label above the preset field.
fieldPlaceholderstring"Share what's on your mind…"Placeholder of the preset field.
fieldType"textarea" | "text" | "email""textarea"Preset field element/type.
submitLabelstring"Send"Label of the preset submit control.
closeOnEscapebooleantrueClose (reverse the morph) on the Escape key.
closeOnOutsideClickbooleantrueClose when clicking outside the surface.
classNamestringExtra classes for the inline root wrapper.

Honors prefers-reduced-motion with a designed static fallback, and passes className through.