Thinking UI

Motion system

Roles, not magic numbers.

Components never write a raw duration or easing. They ask for a role (micro, base, layout or emphasis) and the active personality decides what that means.

Compare personalities

The same component, rendered under each personality at once.

Precise
Pick a suggestion
Smooth
Pick a suggestion
Playful
Pick a suggestion
Cinematic
Pick a suggestion
Elastic
Pick a suggestion

Elasticity

Each personality sets how rubbery things feel: the elastic spring, how much shapes squash and stretch at speed, and how far a drag follows past its limits. Drag a ball past the edge and let go.

Drag and fling

Precise

stretch 0band 0.05

Drag and fling

Smooth

stretch 0.05band 0.15

Drag and fling

Playful

stretch 0.14band 0.35

Drag and fling

Cinematic

stretch 0.04band 0.12

Drag and fling

Elastic

stretch 0.22band 0.55

Roles

micro

Icon swaps, toggles, presses, chevrons

base

Entrances and exits: messages, chips, toasts

layout

Height and position: accordions, sliding pills, stacks

emphasis

Moments that deserve attention: success, numbers, hero

elastic

Rubbery overshoot: drags, switches, cursors, playful reveals

Personality tokens

Springs are listed as visual duration · bounce.

TokenPreciseSmoothPlayfulCinematicElastic
ease.out[0.2, 0, 0, 1][0.16, 1, 0.3, 1][0.34, 1.56, 0.64, 1][0.22, 1, 0.36, 1][0.34, 1.8, 0.64, 1]
duration.base160ms200ms220ms260ms240ms
spring.micro0.15s · 00.2s · 0.10.22s · 0.450.22s · 00.24s · 0.55
spring.base0.22s · 00.26s · 00.28s · 0.350.3s · 00.3s · 0.5
spring.layout0.26s · 00.28s · 0.050.3s · 0.30.32s · 0.050.32s · 0.45
spring.emphasis0.3s · 0.050.32s · 0.150.34s · 0.50.35s · 0.10.35s · 0.65
distance.md4px8px14px20px14px
blur0px4px2px12px0px
scaleFrom0.970.940.60.90.5
pressScale0.970.950.880.970.9
stagger25ms50ms70ms100ms60ms
spring.elastic0.3s · 0.150.32s · 0.350.34s · 0.550.35s · 0.30.35s · 0.75
stretch00.050.140.040.22
rubberBand0.050.150.350.120.55

The personality is also written to CSS variables (--motion-ease-out, --motion-duration-base, …), so CSS transitions like transition-ui follow it too.

Use it in a component

One hook gives you springs, tweens and presets for the active personality.

components/badge.tsx
"use client";
import { motion } from "motion/react";
import { useMotion } from "@/lib/motion";

export function Badge({ children }: { children: React.ReactNode }) {
  const m = useMotion();

  return (
    <motion.span
      {...m.pop()}                 // preset: scale + blur in, using the personality
      whileTap={m.press}           // personality's press scale
      className="rounded-chip bg-chip px-3 text-sm text-chip-fg shadow-bevel"
    >
      {children}
    </motion.span>
  );
}

// Other helpers:
// m.spring("micro" | "base" | "layout" | "emphasis")
// m.tween("fast" | "base" | "slow" | "slower", "out" | "inOut" | "in")
// m.fadeUp(), m.swap(), m.collapse(), m.stagger(i), m.distance.md, m.blur()
// m.drag()                      rubber-band drag that springs home
// useStretch(x, y)              squash & stretch from velocity
// className="transition-elastic"  the elastic spring in plain CSS

Add your own personality

Add an entry and it appears in every switcher automatically.

lib/motion.tsx
// lib/motion.tsx — add a key to `personalities`
export const personalities = {
  // …precise, smooth, playful, cinematic, elastic
  brand: {
    label: "Brand",
    description: "Our house style.",
    ease: { out: [0.25, 1, 0.5, 1], inOut: [0.65, 0, 0.35, 1], in: [0.5, 0, 0.75, 0] },
    duration: { fast: 0.12, base: 0.2, slow: 0.32, slower: 0.5 },
    spring: {
      micro: { visualDuration: 0.2, bounce: 0.15 },
      base: { visualDuration: 0.3, bounce: 0.1 },
      layout: { visualDuration: 0.35, bounce: 0.1 },
      emphasis: { visualDuration: 0.45, bounce: 0.25 },
      elastic: { visualDuration: 0.5, bounce: 0.45 },
    },
    distance: { sm: 3, md: 6, lg: 12 },
    blur: 3,
    scaleFrom: 0.92,
    pressScale: 0.95,
    stagger: 0.04,
    stretch: 0.08,
    rubberBand: 0.2,
  },
} satisfies Record<string, MotionPersonality>;