Skip to content
buttery

v1.0.0

Source on GitHub

Version 1.0.0

Tokens

The springs, durations, easings and delays every buttery animation is made of.

Motion tokens are the named springs, durations, easings and delays buttery animates with, such as spring.smooth or --bt-dur-fast. Use a token for every animation, so timings stay consistent and reduced motion can turn them all down at once.

Springs

Springs move things: positions, sizes and layouts. spring from @butteryui/core holds them for Motion, and useButteryTransition(name) returns one with reduced motion already applied.

TokenSettles inUse
spring.instantthe next frameReduced motion, and snaps nobody is driving
spring.snappyabout 165msSelection indicators, and a menu switching sections
spring.smoothabout 230msThe default: positions, resets, layout and height changes, dialogs
spring.morphabout 345msA big surface changing shape, such as a card becoming a dialog
spring.gentleabout 360msChoreographed entrances only

tsx

import type { ReactElement } from "react";
import { motion } from "motion/react";
import { useButteryTransition } from "@butteryui/core";

export function SelectedMark({ x }: { readonly x: number }): ReactElement {
  const transition = useButteryTransition("snappy");
  return <motion.span animate={{ x }} transition={transition} />;
}

Durations, easings and delays

CSS transitions fade and recolor: opacity, colors and shadows. Each duration and easing is a CSS variable. Enters use --bt-ease-out, and exits --bt-ease-in.

--bt-dur-instant
0ms
--bt-dur-press
80ms
--bt-dur-reduced
100ms
--bt-dur-fast
120ms
--bt-dur-base
200ms
--bt-dur-slow
300ms
--bt-dur-shimmer
1600ms
--bt-ease-out
cubic-bezier(0.22, 1, 0.36, 1)
--bt-ease-in
cubic-bezier(0.4, 0, 1, 1)
--bt-ease-standard
cubic-bezier(0.2, 0, 0, 1)

The timing tokens hold the delays and lifetimes around a transition, such as how long the pointer rests before a menu opens, or how long a toast stays:

TokenValueWhat it times
--bt-stagger50msThe gap between staggered items, closer in a long list
--bt-delay-hover-open150msThe pointer's rest on a trigger before its menu opens
--bt-delay-hover-close100msThe wait after the pointer leaves before a menu closes
--bt-delay-hover-skip300msThe time after a close in which a menu reopens at once
--bt-delay-tooltip500msThe wait before a tooltip opens
--bt-loop-cycle4000msOne step of a Loop
--bt-entrance-max900msThe longest choreographed entrance, stagger included
--bt-celebration900msA confetti burst's life
--bt-toast-life3000msHow long a toast stays while nothing pauses it
--bt-toast-life-action5000msHow long a toast with an action stays
--bt-announcement-life1000msHow long a live region holds what it announced
--bt-typeahead500msHow long typed letters build up one search in a list
--bt-delay-follow80msThe wait before chrome that follows a change arrives
--bt-count-up800msA stat counting up to its number
--bt-delay-submenu40msThe pointer's rest on an item before its submenu opens
--bt-delay-loading300msHow long loading lasts before a loading pill shows
--bt-delay-search120msThe pause after typing before a search asks a server
  • Principles

    The ten rules every buttery animation follows, and the few things it never animates.

  • Presets

    The motion primitives that apply buttery's rules for you, from presence and morphing to reveals and loops.