Command Palette

Search for a command to run...

54
Blog
PreviousNext

Liquid Glass Slider

An iOS 26-inspired liquid glass slider with draggable thumb and SVG refraction effects.

Browser Compatibility

MDN Source
Chrome...
Full
Edge...
Full
Safari...
Full
Firefox...
Partial
Opera...
Full

Compatibility Note for Liquid Glass Refraction:

Firefox supports backdrop-filter but currently lacks support for referring to SVG filters via url(#filterId). This results in the surface appearing as a simple semi-transparent blur without the refractive liquid effect.

Loading...
"use client";
 
import { LiquidGlassSlider } from "@/components/jyotirmoydas/liquid-glass-slider";
 
export function LiquidGlassSliderDemo() {
  return (
    <LiquidGlassSlider
      defaultValue={30}
      onChange={(value) => console.log("Value:", value)}
    />
  );
}

Installation

bunx --bun shadcn@latest add @jyotirmoydas/liquid-glass-slider

Usage

import { LiquidGlassSlider } from "@/components/jyotirmoydas/liquid-glass-slider";
<LiquidGlassSlider
  defaultValue={50}
  onChange={(value) => console.log("Value:", value)}
/>

API Reference

Value Control

PropTypeDefaultDescription
valuenumberControlled value of the slider.
defaultValuenumber10Default value (uncontrolled mode).
minnumber0Minimum value.
maxnumber100Maximum value.
stepnumber1Step size for value changes.
onChange(value: number) => voidCallback when value changes.
onDragStart() => voidCallback when dragging starts.
onDragEnd() => voidCallback when dragging ends.

Appearance

PropTypeDefaultDescription
classNamestringAdditional CSS classes.
widthnumber330Width of the slider track in pixels.
fillColorstring"#0377F7"Color of the track fill (progress).
trackColorstring"#89898F66"Color of the track background.
thumbColorstring"rgba(255, 255, 255, 1)"Color of the thumb.
disabledbooleanfalseWhether the slider is disabled.

Optical Parameters

Fine-tune the liquid glass refraction effect.

PropTypeDefaultDescription
blurnumber0Blur level for the glass refraction effect.
specularOpacitynumber0.4Opacity of the specular highlight.
specularSaturationnumber7Saturation multiplier for the specular highlight.
refractionLevelnumber1Base refraction level (magnification intensity).

Examples

Default

Basic slider with default settings.

Loading...
"use client";
 
import { LiquidGlassSlider } from "@/components/jyotirmoydas/liquid-glass-slider";
 
export function LiquidGlassSliderDemo() {
  return (
    <LiquidGlassSlider
      defaultValue={30}
      onChange={(value) => console.log("Value:", value)}
    />
  );
}

Custom Colors

Customize the fill, track, and thumb colors.

Loading...
"use client";
 
import { LiquidGlassSlider } from "@/components/jyotirmoydas/liquid-glass-slider";
 
export function LiquidGlassSliderCustomColorsDemo() {
  return (
    <LiquidGlassSlider
      defaultValue={50}
      fillColor="#22c55e"
      trackColor="#14532d44"
      thumbColor="rgba(34, 197, 94, 0.9)"
    />
  );
}

Custom Optical Parameters

Fine-tune the glass refraction effect.

Loading...
"use client";
 
import { LiquidGlassSlider } from "@/components/jyotirmoydas/liquid-glass-slider";
 
export function LiquidGlassSliderOpticalDemo() {
  return (
    <LiquidGlassSlider
      defaultValue={60}
      blur={0.3}
      specularOpacity={0.7}
      specularSaturation={10}
      refractionLevel={1.2}
    />
  );
}