Unlock the Power of Interactive Components with Moveable
Moveable, a versatile npm package developed by Korean frontend engineer Younkue Choi, empowers you to create dynamic, user-friendly interfaces. With Moveable, your components can be dragged, resized, scaled, rotated, warped, pinched, grouped, and snapped – the possibilities are endless!
Getting Started with Moveable
To explore the features of Moveable, we’ll use a vanilla JavaScript environment. Create a new directory named “features” and add an HTML file named “index.html” with a script tag. Also, create an empty div
with a class of “root”. This is where the magic happens!
Five Exciting Features to Elevate Your Components
1. Draggable
Transform your components into movable targets with Draggable. Perfect for apps with column-based layouts, like Trello. To enable Draggable, set draggable: true
and pass the target element as an option. Then, use the on
method to attach a handler function to the “drag” event.
2. Resizable
Give users the power to resize components with Resizable. Useful for applications that require dynamic layout adjustments. Set resizable: true
and focus on the “resize” event. By default, keepRatio
is set to false
, but you can change it to maintain the width-to-height ratio.
3. Scalable
Scale components with ease using Scalable. This feature is ideal for image manipulation or zooming in/out. Set scalable: true
and distinguish between resizing and scaling. Use the on
method with the “scale” event to update the component’s size.
4. Rotatable
Add rotation capabilities to your components with Rotatable. Set rotatable: true
and attach a handler function to the “rotate” event. Combine this feature with others to create a dynamic, interactive experience.
5. Warpable
Distort or bend components with Warpable. Set warpable: true
and use the on
method with the “warp” event. Explore the possibilities of warping components in your application.
Moveable in Frameworks and Storybook
Moveable offers custom packages for popular frameworks like React, Angular, Preact, Vue, and Svelte. Experiment with different features on Moveable’s Storybook page without any setup.
Take Your Debugging to the Next Level
LogRocket’s frontend monitoring solution helps you debug JavaScript errors more efficiently. Understand the context behind errors and optimize your application’s performance with LogRocket. Try it for free today!