A smooth, animated React slider with draggable feel, dynamic progress, and a floating value label. Created by Samet Ozkale.
Drag the thumb or click on the track to feel the slider's motion.
Available in three sizes: sm, md, and lg.
Customize colors with CSS custom properties for dark mode or any theme.
Border, fill, thumb, and label colors can be customized
via CSS variables for seamless theme integration.
Install the package and add the component to your React app. Requires Tailwind CSS and the peer dependencies listed below.
Install the package and peer dependencies. Ensure Tailwind CSS is configured and the package is included in your Tailwind content path.
# Core package
npm install @sametozkale/slider-one
# Peer dependency
npm install framer-motionCompose the slider with the root, track, progress, thumb, and label exports. The motion layer and keyboard support are already included.
import { useState } from "react";
import {
Slider,
SliderLabel,
SliderProgress,
SliderThumb,
SliderTrack,
} from "@sametozkale/slider-one";
function RadiusControl() {
const [radius, setRadius] = useState(28);
return (
<Slider
min={0}
max={64}
step={1}
value={radius}
onValueChange={setRadius}
aria-label="Radius"
size="md"
tokens={{
trackHeight: "36px",
trackRadius: "12px",
trackBg: "#f2f2f2",
trackBorder: "#f2f2f2",
progressBg: "#ffffff",
labelBg: "rgba(23, 24, 26, 0.96)",
labelText: "#ffffff",
labelMuted: "rgba(255, 255, 255, 0.68)",
focusRing: "rgba(23, 24, 26, 0.1)",
}}
>
<SliderTrack>
<SliderLabel label="Radius" formatter={(value) => `${value}px`} />
<SliderProgress leftLabel="Radius" />
<SliderThumb />
</SliderTrack>
</Slider>
);
}Add the package dist files as a source so Tailwind keeps the generated utility classes used inside the package.
@import "tailwindcss";
@source "../node_modules/@sametozkale/slider-one/dist/**/*.js";Use CSS custom properties to align the component with your brand, dark mode, or a specific product surface.
.slider-demo {
--so-track-bg: transparent;
--so-track-border: #f2f2f2;
--so-progress-bg: #ffffff;
}