@neshel-ui/animations/press
Every export of @neshel-ui/animations/press, generated from its declarations.
Experimental and not on npm
Signatures, members and defaults, generated from the built declarations. For explanations and examples read the guide.
CheckboxDrawcomponentDecorative checkbox glyph (aria-hidden SVG) that draws its check mark. Mirror a native checkbox.
({ checked, indeterminate, duration, easing, reducedMotion, className, ref, ...rest }: CheckboxDrawProps): ElementContentSwapcomponentCross-fades two contents in place. The inactive one is `hidden` (correct without CSS or JavaScript); with `press.css` the swap fades and slides (opacity only under reduced motion).
({ active, children, confirm, live, reducedMotion, className, ref, ...rest }: ContentSwapProps): ElementLongPresscomponentP11 `<LongPress>`: hold to activate, with a progress layer (`press.css`). Usually `asChild` on your own `<button>`; describe the hold in its label or nearby text, and keep a non-timed path for destructive actions.
(props: LongPressProps): ElementNumberTickcomponentA number that counts to each new value. The counting copy is aria-hidden and written without React renders; assistive technologies read a visually hidden copy with the final value.
({ value, format, locale, formatOptions, duration, easing, reducedMotion, live, className, ref, ...rest }: NumberTickProps): ElementPresscomponent`<Press>`: press & microinteraction effects on a `<div>` or, with `asChild`, your own element.
<Options, Resolved>(props: PressProps<Options, Resolved>): ElementToggleMorphcomponentDecorative switch track and thumb (aria-hidden). Use inside a native control, e.g. `<button role="switch" aria-checked={on}>` or a `<label>` with an `<input type="checkbox" role="switch">`.
({ checked, spring, stretch, reducedMotion, className, ref, ...rest }: ToggleMorphProps): ElementburstconstReadonly<EffectDefinition<BurstOptions, ResolvedBurst>>checkboxDrawconstReadonly<EffectDefinition<CheckboxDrawOptions, ResolvedCheckboxDraw>>contentSwapconstReadonly<EffectDefinition<ContentSwapOptions, { reducedMotion: ReducedMotion; }>>longPressconstReadonly<EffectDefinition<LongPressOptions, ResolvedLongPress>>nudgeconstReadonly<EffectDefinition<NudgeOptions, ResolvedNudge>>numberTickconstReadonly<EffectDefinition<NumberTickOptions, ResolvedNumberTick>>pressEffectsconstEvery press definition in catalogue order (P01–P11), for explicit registries.
readonly AnyEffectDefinition[]pressScaleconstReadonly<EffectDefinition<PressScaleOptions, ResolvedPressScale>>rippleconstReadonly<EffectDefinition<RippleOptions, ResolvedRipple>>shakeconstReadonly<EffectDefinition<ShakeOptions, ResolvedShake>>tapBounceconstReadonly<EffectDefinition<TapBounceOptions, ResolvedTapBounce>>toggleMorphconstReadonly<EffectDefinition<ToggleMorphOptions, ResolvedToggleMorph>>BurstOptionsinterfaceBurstOptions
P06 — Burst: particles radiate from the centre on an owned layer when
triggerchanges.BurstOptions Prop Type Default Description colors readonly string[]— Particle colours, cycled (default theme-friendly warm colours). count number— Number of particles (3–24, default 10). disabled boolean— Turn the effect off. Disabled elements ( :disabled,aria-disabled="true") never react.distance number— Travel distance in px (8–160, default 34). duration number— Duration in ms (200–3000, default 650). reducedMotion ReducedMotion"user"Reduced-motion policy (default "user").size number— Particle size in px (2–16, default 6). trigger string | number | boolean— Change this value (a counter, a timestamp) to play the effect. The initial value never plays. CheckboxDrawOptionsinterfaceCheckboxDrawOptions
CheckboxDrawOptions Prop Type Default Description checked(required) boolean | "indeterminate"— Current state (mirror your checkbox). duration number | "fast" | "normal" | "slow" | "deliberate"240Draw duration in ms or preset (default 240). easing Easing | EasingPreset— — reducedMotion ReducedMotion— — CheckboxDrawPropsinterfaceCheckboxDrawProps
CheckboxDrawProps Prop Type Default Description checked(required) boolean— — duration number | "fast" | "normal" | "slow" | "deliberate"240Draw duration in ms or preset (default 240). easing Easing | EasingPreset— — indeterminate boolean— — reducedMotion ReducedMotion— — ref Ref<SVGSVGElement>— — Also accepts the props of: React DOM attributes.
ContentSwapOptionsinterfaceContentSwapOptions
ContentSwapOptions Prop Type Default Description reducedMotion ReducedMotion— — ContentSwapPropsinterfaceContentSwapProps
ContentSwapProps Prop Type Default Description active(required) boolean— Show confirminstead ofchildren(e.g.copied).children(required) ReactNode— Content while idle (e.g. "Copy"). confirm(required) ReactNode— Content while active (e.g. "Copied ✓"). live "off" | "polite""off"Announce the new content politely when it changes (default "off").reducedMotion ReducedMotion— — ref Ref<HTMLSpanElement>— — Also accepts the props of: React DOM attributes.
LongPressOptionsinterfaceLongPressOptions
LongPressOptions Prop Type Default Description disabled boolean— — duration number— Hold time in ms (200–5000, default 600). keyboard "hold" | "press"— Keyboard: hold Space/Enter for the duration ( "hold", default) or activate on one press ("press").moveTolerance number— px of pointer movement that cancels (2–50, default 10). onCancel () => void— Called when a started press ends without completing. onLongPress (source: "pointer" | "keyboard") => void— Called once per completed long press. pointerTypes readonly ("mouse" | "pen" | "touch")[]— Pointer types that may long-press (default mouse, pen and touch). reducedMotion ReducedMotion"user"Reduced motion keeps a linear, non-vestibular fill (the progress conveys state). Default "user".LongPressPropsinterfaceLongPressProps
LongPressProps Prop Type Default Description asChild boolean— Apply the effects to the single child element instead of rendering a <div>.children ReactNode— — conflicts ConflictPolicy— Conflict reporting for exclusive channels (default: warn in development). disabled boolean— — duration number— Hold time in ms (200–5000, default 600). keyboard "hold" | "press"— Keyboard: hold Space/Enter for the duration ( "hold", default) or activate on one press ("press").moveTolerance number— px of pointer movement that cancels (2–50, default 10). onCancel () => void— Called when a started press ends without completing. onLongPress (source: "pointer" | "keyboard") => void— Called once per completed long press. pointerTypes LongPressOptions["pointerTypes"]— — reducedMotion ReducedMotion"user"Reduced motion keeps a linear, non-vestibular fill (the progress conveys state). Default "user".ref Ref<HTMLDivElement>— — Also accepts the props of: React DOM attributes.
NudgeOptionsinterfaceNudgeOptions
P08 — Nudge / attention jiggle: a short rotation wiggle, optionally repeated a few times.
NudgeOptions Prop Type Default Description angle number— Amplitude in degrees (1–20, default 6). cycles number— Oscillations (1–6, default 3). disabled boolean— Turn the effect off. Disabled elements ( :disabled,aria-disabled="true") never react.duration number— Duration in ms (100–2000, default 600). interval number— Pause between plays in ms (1000–10000, default 2500). reducedMotion ReducedMotion"user"Reduced-motion policy (default "user").repeat number— Extra plays after the first (0–3, default 0); never more than 4 plays in total (WCAG 2.2.2). trigger string | number | boolean— Change this value (a counter, a timestamp) to play the effect. The initial value never plays. NumberTickOptionsinterfaceNumberTickOptions
NumberTickOptions Prop Type Default Description duration number | "fast" | "normal" | "slow" | "deliberate"600Count duration in ms or preset (default 600). easing Easing | EasingPreset— — format (value: number) => stringIntl.NumberFormat(locale, formatOptions)Formats the displayed number (default Intl.NumberFormat(locale, formatOptions)).formatOptions Intl.NumberFormatOptions— — locale string"en-US"Locale of the default formatter (default "en-US", explicit so server and client agree).reducedMotion ReducedMotion— — value(required) number— — NumberTickPropsinterfaceNumberTickProps
NumberTickProps Prop Type Default Description duration number | "fast" | "normal" | "slow" | "deliberate"600Count duration in ms or preset (default 600). easing Easing | EasingPreset— — format (value: number) => stringIntl.NumberFormat(locale, formatOptions)Formats the displayed number (default Intl.NumberFormat(locale, formatOptions)).formatOptions Intl.NumberFormatOptions— — live "off" | "polite""off"Announce changes politely (default "off"). Announcements carry the final value once per change, never per frame.locale string"en-US"Locale of the default formatter (default "en-US", explicit so server and client agree).reducedMotion ReducedMotion— — ref Ref<HTMLSpanElement>— — value(required) number— — Also accepts the props of: React DOM attributes.
PressOptionsinterfacePressOptions
Options shared by press effects.
PressOptions Prop Type Default Description disabled boolean— Turn the effect off. Disabled elements ( :disabled,aria-disabled="true") never react.reducedMotion ReducedMotion"user"Reduced-motion policy (default "user").PressScaleOptionsinterfacePressScaleOptions
P01 — Press scale: shrink while pressed, spring back on release (pointer, Space/Enter).
PressScaleOptions Prop Type Default Description disabled boolean— Turn the effect off. Disabled elements ( :disabled,aria-disabled="true") never react.reducedMotion ReducedMotion"user"Reduced-motion policy (default "user").scale number— Scale while pressed (0.5–1, default 0.96). Reduced motion keeps half the amplitude, without spring. spring SpringOptions | SpringPreset— — RippleOptionsinterfaceRippleOptions
P02 — Ripple: an expanding circle from the press point on a clipped, owned layer.
RippleOptions Prop Type Default Description color stringcurrentColorRipple colour (default currentColor).disabled boolean— Turn the effect off. Disabled elements ( :disabled,aria-disabled="true") never react.duration number— Expansion duration in ms (100–3000, default 550). opacity number— Ripple opacity (0–1, default 0.22). reducedMotion ReducedMotion"user"Reduced-motion policy (default "user").ShakeOptionsinterfaceShakeOptions
P07 — Shake (error): a short damped horizontal shake. Never the only error signal.
ShakeOptions Prop Type Default Description cycles number— Oscillations (1–8, default 4). disabled boolean— Turn the effect off. Disabled elements ( :disabled,aria-disabled="true") never react.distance number— Amplitude in px (1–30, default 8). Reduced motion: a third, fewer cycles. duration number— Duration in ms (100–2000, default 420). reducedMotion ReducedMotion"user"Reduced-motion policy (default "user").trigger string | number | boolean— Change this value (a counter, a timestamp) to play the effect. The initial value never plays. TapBounceOptionsinterfaceTapBounceOptions
P03 — Tap bounce: a springy squash after each activation (click, including keyboard).
TapBounceOptions Prop Type Default Description disabled boolean— Turn the effect off. Disabled elements ( :disabled,aria-disabled="true") never react.reducedMotion ReducedMotion"user"Reduced-motion policy (default "user").spring SpringOptions | SpringPreset"bouncy"Spring (default "bouncy").strength number— Impulse strength (0–1, default 0.3). ToggleMorphOptionsinterfaceToggleMorphOptions
ToggleMorphOptions Prop Type Default Description checked(required) boolean— Current state (mirror your switch's checked/aria-checked).reducedMotion ReducedMotion— — spring SpringOptions | SpringPreset"snappy"Thumb spring (default "snappy").stretch number— Peak stretch of the thumb mid-travel (0–0.6, default 0.3). ToggleMorphPropsinterfaceToggleMorphProps
ToggleMorphProps Prop Type Default Description checked(required) boolean— Mirror of your switch's state. reducedMotion ReducedMotion— — ref Ref<HTMLSpanElement>— — spring SpringOptions | "gentle" | "snappy" | "bouncy"— — stretch number— Peak thumb stretch mid-travel (0–0.6, default 0.3). Also accepts the props of: React DOM attributes.
TriggerOptionsinterfaceTriggerOptions
triggerhandling: plays when the value changes after attachment.TriggerOptions Prop Type Default Description trigger string | number | boolean— Change this value (a counter, a timestamp) to play the effect. The initial value never plays. PressPropstypePressProps
PressProps Prop Type Default Description asChild boolean— Apply the effects to the single child element instead of rendering a <div>.children ReactNode— — conflicts ConflictPolicy— Conflict reporting for exclusive channels (default: warn in development). options undefined | NoInfer<Partial<Options>>— — preset(required) readonly PresetInput<any, any>[] | PresetInput<Options, Resolved>— — ref Ref<HTMLDivElement>— — Also accepts the props of: React DOM attributes.