Goo Slider

Press the knob and a drop of goo pulls up out of it with the value, then drips back in.

64

Price $180 – $640

Quality 1080p

62

Installation

Terminal
npx shadcn@latest add https://fabrickit.org/r/goo-slider.json

This copies the component into components/fabricui and its engine into lib/fabricui. It's your code from then on. First time? Add the theme once: see Installation.

Code

components/fabricui/goo-slider.tsx
"use client";

import * as React from "react";
import { ensureGooFilters } from "@/lib/fabricui/goo";
import { GooSliderEngine } from "@/lib/fabricui/goo-slider-engine";
import "./goo-slider.css";

export type GooSliderProps = {
  /** The value (controlled). Leave out to let the slider keep its own. */
  value?: number;
  /** The starting value when uncontrolled. */
  defaultValue?: number;
  min?: number;
  max?: number;
  /** Called with each new whole-number value as it changes. */
  onValueChange?: (value: number) => void;
components/fabricui/goo-slider.css
/*
 * Goo Slider
 * Everything moves on springs: the knob glides to the pointer; press it and
 * a drop of goo pulls up out of the knob, pinches off and floats above with
 * the value; let go and it drips back in. The drop trails the knob a beat
 * behind, so it swings when you drag fast. The goo filter covers the knob and
 * the drop only; the number sits on top, crisp.
 */
.fui-gs {
  position: relative;
  height: 28px;            /* the hit area; the track is drawn in its middle */
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.fui-gs__track, .fui-gs__fill {
lib/fabricui/goo-slider-engine.js
/*
 * goo-slider-engine.js — the Goo Slider's motion, framework-free.
 * The React component (components/fabricui/goo-slider.tsx) renders the parts
 * and hands them over; this moves them, every frame, on springs.
 */
import { GooKit } from "./goo";

/**
 * GooSlider. The value is whole numbers between min and max; the picture is
 * all springs:
 *   knob x   follows the pointer, stiff and critically damped (silky, no wobble)
 *   drop x   follows the knob, looser and a little bouncy (it swings behind)
 *   lift     the drop rising out of the knob while pressed, with a little bob
 *   press    the knob swelling slightly while held
 * Keyboard: arrows ±1 (Shift ±10), Page Up/Down ±10, Home/End.
 */
components/fabricui/goo-range.tsx
"use client";

import * as React from "react";
import { mount } from "@/lib/fabricui/mount";
import { ensureGooFilters } from "@/lib/fabricui/goo";
import { GooRange as GooRangeEngine } from "@/lib/fabricui/goo-range-engine";
import "./goo-range.css";

const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;

export type GooRangeProps = {
  /** The two values, low and high (controlled). Leave out to let the slider keep its own. */
  value?: [number, number];
  /** The starting values when uncontrolled. */
  defaultValue?: [number, number];
  min?: number;
components/fabricui/goo-range.css
/*
 * Goo sliders — Value, Range, Steps, Liquid (goo-sliders.js; needs goo.js). The liquid parts sit
 * in a layer under the page's #goo filter (an SVG filter: blur, then a hard
 * alpha cut; Steps uses the tighter #goo-sm), so whatever touches flows
 * together. Thin bars and numbers stay outside it, crisp.
 */

/* shared: the invisible, focusable stand-in for a knob, with its ring while held */
.gx-handle:where(.fui-goo-range, .fui-goo-range *) {
  position: absolute;
  left: 0;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
lib/fabricui/goo-range-engine.js
/*
 * goo-range-engine.js — from goo-sliders.js (styles in components/fabricui/goo-range.css).
 *
 *   new GooRange(el, { min, max, step, values: [lo, hi], format, onChange })
 *     Two knobs on one bar; each knob melts into the bar between them, and
 *     when they meet they fuse into a single drop.
 * Its liquid parts sit in one layer under the #fabric-goo filter (blur, then a hard
 * alpha cut), so shapes that touch flow into each other. Everything moves on
 * springs, every frame. Keyboard: arrows (Shift ×10), Page Up/Down, Home/End.
 */
import { GooKit } from "./goo";

export class GooRange {
  /**
   * @param {HTMLElement} root the .gr element
   * @param {{ min?: number, max?: number, step?: number, values?: number[], format?: (v: number) => string, onChange?: (values: number[]) => void }} [options]
components/fabricui/goo-steps.tsx
"use client";

import * as React from "react";
import { mount } from "@/lib/fabricui/mount";
import { ensureGooFilters } from "@/lib/fabricui/goo";
import { GooSteps as GooStepsEngine } from "@/lib/fabricui/goo-steps-engine";
import "./goo-steps.css";

const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;

export type GooStepsProps = {
  /** The steps' names, in order (shown under their dots). Read when it mounts. */
  steps: string[];
  /** The chosen step's index (controlled). Leave out to let the slider keep its own. */
  value?: number;
  /** The starting step when uncontrolled. */
components/fabricui/goo-steps.css
/*
 * Goo sliders — Value, Range, Steps, Liquid (goo-sliders.js; needs goo.js). The liquid parts sit
 * in a layer under the page's #goo filter (an SVG filter: blur, then a hard
 * alpha cut; Steps uses the tighter #goo-sm), so whatever touches flows
 * together. Thin bars and numbers stay outside it, crisp.
 */

/* shared: the invisible, focusable stand-in for a knob, with its ring while held */
.gx-handle:where(.fui-goo-steps, .fui-goo-steps *) {
  position: absolute;
  left: 0;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
lib/fabricui/goo-steps-engine.js
/*
 * goo-steps-engine.js — from goo-sliders.js (styles in components/fabricui/goo-steps.css).
 *
 *   new GooSteps(el, { steps: ["240p", …], value, onChange })
 *     A bead on a string of step dots: it slides freely while you drag,
 *     swallowing each dot it passes, and drops into the nearest step with a
 *     little wobble when you let go.
 * Its liquid parts sit in one layer under the #fabric-goo filter (blur, then a hard
 * alpha cut), so shapes that touch flow into each other. Everything moves on
 * springs, every frame. Keyboard: arrows (Shift ×10), Page Up/Down, Home/End.
 */
import { GooKit } from "./goo";

export class GooSteps {
  /**
   * @param {HTMLElement} root the .gst element
components/fabricui/goo-liquid.tsx
"use client";

import * as React from "react";
import { mount } from "@/lib/fabricui/mount";
import { ensureGooFilters } from "@/lib/fabricui/goo";
import { GooLiquid as GooLiquidEngine } from "@/lib/fabricui/goo-liquid-engine";
import "./goo-liquid.css";

const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;

export type GooLiquidProps = {
  /** The value, 0 – 100 (controlled). Leave out to let the slider keep its own. */
  value?: number;
  /** The starting value when uncontrolled. */
  defaultValue?: number;
  /** Called with each new whole-number value. */
components/fabricui/goo-liquid.css
/*
 * Goo sliders — Value, Range, Steps, Liquid (goo-sliders.js; needs goo.js). The liquid parts sit
 * in a layer under the page's #goo filter (an SVG filter: blur, then a hard
 * alpha cut; Steps uses the tighter #goo-sm), so whatever touches flows
 * together. Thin bars and numbers stay outside it, crisp.
 */

/* ---------- Liquid ---------- */
.gl:where(.fui-goo-liquid, .fui-goo-liquid *) {
  position: relative;
  height: 48px;
  border-radius: calc(48px * var(--fabric-roundness));
  background: var(--fabric-surface);
  box-shadow: var(--fabric-edge);
  overflow: hidden;
  cursor: pointer;
lib/fabricui/goo-liquid-engine.js
/*
 * goo-liquid-engine.js — from goo-sliders.js (styles in components/fabricui/goo-liquid.css).
 *
 *   new GooLiquid(el, { value, onChange })
 *     A thick bar filled with liquid (a volume control). The liquid's front
 *     reaches for your finger ahead of the rest of it, stretching on a neck,
 *     then the body catches up and the surface settles flat.
 * Its liquid parts sit in one layer under the #fabric-goo filter (blur, then a hard
 * alpha cut), so shapes that touch flow into each other. Everything moves on
 * springs, every frame. Keyboard: arrows (Shift ×10), Page Up/Down, Home/End.
 */
import { GooKit } from "./goo";

export class GooLiquid {
  /**
   * @param {HTMLElement} root the .gl element

Usage

Usage
"use client";

import * as React from "react";
import { GooSlider } from "@/components/fabricui/goo-slider";
import { GooRange } from "@/components/fabricui/goo-range";

export function Volume() {
  const [value, setValue] = React.useState(64);
  return <GooSlider value={value} onValueChange={setValue} label="Volume" />;
}

// the other three work the same way: GooRange (two knobs), GooSteps (snaps to stops), GooLiquid
export function Budget() {
  const [range, setRange] = React.useState<[number, number]>([180, 640]);
  return <GooRange min={0} max={1000} step={10} value={range} onValueChange={setRange} />;
}

Props

PropTypeDefault
value

The value, if you control it.

number—
defaultValue

The starting value when you don't.

number50
min

The lowest value.

number0
max

The highest value.

number100
onValueChange

Called with each new whole-number value.

(value: number) => void—
label

The accessible name.

string"Value"