next-motion
v0.0.4
Published
A library for using Framer Motion with Next.js without the need for 'use client'.
Maintainers
Readme
next-motion
A library for using Framer Motion with Next.js without the need for 'use client'.
Installation
npm install next-motion
# or
yarn add next-motionUsage
Using next-motion is straightforward and similar to using Framer Motion directly. The only difference is that you import the component you want to animate from next-motion instead of framer-motion.
Example
- Import the component you want to animate from
next-motion:
import { Motion } from "next-motion";- Use the imported component as you would with Framer Motion, applying the desired animations:
<Motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.5 }}
className="max-w-sm rounded relative w-full"
>
{/* Your content goes here */}
</Motion.div>In the example above, we import Motion.div from next-motion and apply the initial, animate, and transition props to control the animation, just like you would with motion.div from framer-motion.
The available components in next-motion are:
Motion.divMotion.h1Motion.h2Motion.h3Motion.h4Motion.h5Motion.h6Motion.pMotion.spanMotion.buttonMotion.inputMotion.textareaMotion.formMotion.labelMotion.imgMotion.aMotion.navMotion.sectionMotion.articleMotion.headerMotion.footerMotion.asideMotion.mainMotion.ulMotion.olMotion.liMotion.dlMotion.dtMotion.ddMotion.tableMotion.trMotion.tdMotion.thMotion.tbodyMotion.theadMotion.tfootMotion.caption
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
