Capítulo 140 de 142
Curated recipes from Motion's official examples gallery for sliders & carousels. Each entry is implemented in one or more of vanilla JS, React, and Vue; consult the framework-specific example on motion.dev for the full runnable version.
"use client"
import { useRef } from "react"
export default function Slider({
maxPull = 20,
maxSquish = 0.92,
maxStretch = 1.08,
keyboardStep = 0.05,
keyboardSpring = { stiffness: 200, damping: 60 },
}) {
const ref = useRef(null)
return (
<div style={container}>
<div ref={ref} style={slider}>
<div style={indicator} />
<div>
// ...
"use client"
import { motion, useMotionValue } from "motion/react"
export default function CameraExposureSlider() {
const exposure = useMotionValue(0)
return (
<div className="container">
<div className="image-container">
<img src="your-image.jpg" alt="Sample photo" />
</div>
<ProgressIndicator value={exposure} />
<div className="exposure-slider">{/* Carousel will go here */}</div>
</div>
)
// ...