Beta Status

This library is still in early beta and the API is subject to change and may get daily breaking changes. The documentaton may not be up to date with the latest features and include missing or outdated information. You can always create an issue on GitHub or even better a pull request to fix the documentation or add new features.

API Reference

This is the public surface exported from motion-solid.

Components

  • motion: proxy that exposes motion.div, motion.svg, and all other HTML/SVG tags.
  • AnimatePresence: enables exit animations. See AnimatePresence.
  • MotionConfig: global defaults for transitions and reduced motion. See MotionConfig.

Contexts

  • MotionStateContext and useMotionState: access the internal motion state (advanced).
  • MotionConfigContext and useMotionConfig: access motion configuration.
  • PresenceContext: internal presence context used by AnimatePresence.

Hooks

  • usePresence: presence state plus a safeToRemove callback.
  • useIsPresent: presence state only.
  • usePresenceData: reads the custom payload from AnimatePresence.
  • useReducedMotion: access prefers-reduced-motion as a Solid accessor.

Utilities

  • createMotionComponent: create a motion component for a specific tag.
  • createMotionState: build a MotionState object (advanced).
  • useAnimationState: low-level animation controller hook.
  • useGestures: low-level gesture hook used by the motion component.
  • createDragControls: programmatic drag controller.
  • stagger and isStaggerFunction: helpers for orchestrating variants.
  • motionKeys: list of props consumed by motion components.
  • animationTypes and buildAnimationTypeMotionValues: animation helpers.
  • isSVGElement and isHTMLElement: element tag checks.

Types

Common types include MotionProps, MotionOptions, MotionState, MotionValues, MotionGoals, MotionGesturesState, MotionVariantsState, AnimatePresenceProps, and MotionConfigProps. Motion Solid also re-exports Motion types like Variant, Variants, and Transition from motion-dom.

Notes

Low-level APIs are provided for advanced use cases and may change during the beta.