Skip to content

Material 3

Theme

Motion

Easing, duration, springs and transitions.

Use the Material 3 motion tokens as Tailwind's ease-* and duration-* utilities: the springs of the expressive and standard motion schemes, and the easing and duration sets. A transition preset puts a whole component on the springs with one class, and every duration follows the reader's reduced motion setting.

Springs

The theme's motion follows Material's motion physics system, where springs drive the motion of the components. Apply a spring with a pair of classes, its duration and its easing: duration-spring-<name> ease-spring-<name>. Add a transition-* class for what moves.

<div class="transition-transform duration-spring-default-spatial ease-spring-default-spatial"></div>

There are six springs: fast, default and slow, each spatial or effects.

  • Spatial: Use a spatial spring for what changes place, size or shape. It overshoots in the expressive scheme.
  • Effects: Use an effects spring for color and opacity. It does not overshoot.
fast-spatial
default-spatial
slow-spatial
fast-effects
default-effects
slow-effects
import { Button, twMerge } from '@material-web/react'
import { useState } from 'react'

const springs = [
  ['duration-spring-fast-spatial ease-spring-fast-spatial', 'fast-spatial'],
  ['duration-spring-default-spatial ease-spring-default-spatial', 'default-spatial'],
  ['duration-spring-slow-spatial ease-spring-slow-spatial', 'slow-spatial'],
  ['duration-spring-fast-effects ease-spring-fast-effects', 'fast-effects'],
  ['duration-spring-default-effects ease-spring-default-effects', 'default-effects'],
  ['duration-spring-slow-effects ease-spring-slow-effects', 'slow-effects'],
] as const

export default function MotionSprings() {
  const [isMoved, setMoved] = useState(false)
  return (
    <div className="flex flex-col gap-space-150">
      {springs.map(([spring, name]) => (
        <div key={name} className="flex flex-col gap-space-50">
          <code className="font-mono text-label-md text-on-surface-variant">{name}</code>
          <div className="w-64 rounded-shape-full bg-surface-container-high px-space-300">
            <div
              className={twMerge(
                spring,
                'size-6 rounded-shape-full bg-primary transition-transform',
                isMoved ? 'translate-x-58' : '',
              )}
            />
          </div>
        </div>
      ))}
      <Button variant="tonal" className="self-start" onPress={() => setMoved(!isMoved)}>
        Move
      </Button>
    </div>
  )
}
SpringClassesMaterial's example
Fast spatialduration-spring-fast-spatial
ease-spring-fast-spatial
Small components, such as switches and buttons
Default spatialduration-spring-default-spatial
ease-spring-default-spatial
Animations that partially cover the screen, such as bottom sheet and expanded navigation rail
Slow spatialduration-spring-slow-spatial
ease-spring-slow-spatial
Full-screen animations
Fast effectsduration-spring-fast-effects
ease-spring-fast-effects
Color change of the switch handle
Default effectsduration-spring-default-effects
ease-spring-default-effects
Opacity of the content within a navigation rail
Slow effectsduration-spring-slow-effects
ease-spring-slow-effects
Full-screen content refresh

Material uses the default speed for most motion, the fast one for smaller elements and the slow one for larger elements.

  • Pairs: Use the two classes of one spring together. A spring's easing is drawn for its own duration.
  • Delay: The theme has no delay classes. Use Tailwind's own delay-*, such as delay-100.
  • JavaScript: For a spring run in JavaScript, use its damping and stiffness tokens: --md-sys-motion-spring-fast-spatial-damping and -stiffness.
  • Your own CSS: Use a spring's duration and easing as custom properties, as in transition: transform var(--md-sys-motion-spring-default-spatial-duration) var(--md-sys-motion-spring-default-spatial-easing).
  • Merged classes: tailwind-merge does not know the theme's durations and easings, and keeps both of two, such as duration-short-2 duration-spring-fast-effects. To merge them, use the tv or the twMerge that @material-web/react exports, where the later class replaces the earlier one.

Motion scheme

Set data-motion="standard" on the root to use the standard motion scheme. The expressive scheme is the default. To try them on this page, use the menu in this site's app bar.

<html data-motion="standard"></html>
SchemeAttributeUse
ExpressiveNone, the defaultMost situations, particularly hero moments and key interactions
Standarddata-motion="standard"Utilitarian products, for motion that feels more functional, with minimal bounce

The scheme sets the springs: the expressive spatial springs overshoot, and the standard ones settle with next to no overshoot. The effects springs are the same in both schemes.

Set the attribute on any other element for the spring classes inside it. data-motion="expressive" returns a part of a standard page to the default.

data-motion="expressive"
data-motion="standard"
import { Button, twMerge } from '@material-web/react'
import { useState } from 'react'

const schemes = [
  ['expressive', 'data-motion="expressive"'],
  ['standard', 'data-motion="standard"'],
] as const

export default function MotionSchemes() {
  const [isMoved, setMoved] = useState(false)
  return (
    <div className="flex flex-col gap-space-150">
      {schemes.map(([scheme, name]) => (
        <div key={scheme} data-motion={scheme} className="flex flex-col gap-space-50">
          <code className="font-mono text-label-md text-on-surface-variant">{name}</code>
          <div className="w-64 rounded-shape-full bg-surface-container-high px-space-300">
            <div
              className={twMerge(
                'size-6 rounded-shape-full bg-primary transition-transform duration-spring-fast-spatial ease-spring-fast-spatial',
                isMoved ? 'translate-x-58' : '',
              )}
            />
          </div>
        </div>
      ))}
      <Button variant="tonal" className="self-start" onPress={() => setMoved(!isMoved)}>
        Move
      </Button>
    </div>
  )
}

Note: The transition presets, and the components that use them, such as Button, take the scheme of the root.

Transition presets

A plain transition-* class cannot put its properties on different springs. Use a preset to do so: it puts the shape and the size on the fast spatial spring, and the colors and the shadow on the fast effects one.

<button
  class="rounded-shape-xl bg-secondary-container transition-shape-color hover:rounded-shape-md"
></button>
ClassOn the fast spatial springOn the fast effects spring
transition-shape-color-shadowCorner radiusBackground color, color, shadow
transition-shape-colorCorner radiusBackground color, color
transition-space-color-shadowPaddingBackground color, color, shadow
transition-color-shadowNoneBackground color, color, shadow
transition-revealWidth and end marginNone
transition-fadeNoneOpacity
transition-fade-visibilityNoneOpacity, and visibility over the same time
transition-width-fade-color-shadowWidthOpacity, background color, color, shadow
  • Complete: A preset sets the properties, their durations and their easings. It needs no duration-* or ease-* class.
  • One for each element: Use one transition class on an element, the preset that names every property that changes. Of two, one replaces the other.
  • Other properties: For a property that no preset names, such as a transform, use Tailwind's transition-* class with the two classes of a spring.

Easing and duration

Use the easing and duration tokens for a transition that runs on a curve and a time instead of a spring. Material keeps them for transitions, such as an element that enters or leaves the screen.

<div class="transition-opacity duration-medium-4 ease-emphasized-decelerate"></div>
ease-standard
ease-standard-accelerate
ease-standard-decelerate
ease-emphasized
ease-emphasized-accelerate
ease-emphasized-decelerate
ease-linear
import { Button, twMerge } from '@material-web/react'
import { useState } from 'react'

const easings = [
  ['ease-standard', 'ease-standard'],
  ['ease-standard-accelerate', 'ease-standard-accelerate'],
  ['ease-standard-decelerate', 'ease-standard-decelerate'],
  ['ease-emphasized', 'ease-emphasized'],
  ['ease-emphasized-accelerate', 'ease-emphasized-accelerate'],
  ['ease-emphasized-decelerate', 'ease-emphasized-decelerate'],
  ['ease-linear', 'ease-linear'],
] as const

export default function MotionEasing() {
  const [isMoved, setMoved] = useState(false)
  return (
    <div className="flex flex-col gap-space-150">
      {easings.map(([easing, name]) => (
        <div key={name} className="flex flex-col gap-space-50">
          <code className="font-mono text-label-md text-on-surface-variant">{name}</code>
          <div className="w-64 rounded-shape-full bg-surface-container-high">
            <div
              className={twMerge(
                easing,
                'size-6 rounded-shape-full bg-tertiary transition-transform duration-long-2',
                isMoved ? 'translate-x-58' : '',
              )}
            />
          </div>
        </div>
      ))}
      <Button variant="tonal" className="self-start" onPress={() => setMoved(!isMoved)}>
        Move
      </Button>
    </div>
  )
}

Easing

Material has two sets of three easings. The emphasized set is the most common, and the standard set is for simple, small or utility-focused transitions.

Class and tokenCurve
ease-standard
--md-sys-motion-easing-standard
cubic-bezier(0.2, 0, 0, 1)
ease-standard-accelerate
--md-sys-motion-easing-standard-accelerate
cubic-bezier(0.3, 0, 1, 1)
ease-standard-decelerate
--md-sys-motion-easing-standard-decelerate
cubic-bezier(0, 0, 0, 1)
ease-emphasized
--md-sys-motion-easing-emphasized
cubic-bezier(0.2, 0, 0, 1)
ease-emphasized-accelerate
--md-sys-motion-easing-emphasized-accelerate
cubic-bezier(0.3, 0, 0.8, 0.15)
ease-emphasized-decelerate
--md-sys-motion-easing-emphasized-decelerate
cubic-bezier(0.05, 0.7, 0.1, 1)
ease-linear
--md-sys-motion-easing-linear
cubic-bezier(0, 0, 1, 1)

Material's emphasized curve has no CSS form, so ease-emphasized is the standard curve, its fallback on the web. Tailwind's own easings, such as ease-in-out, are unchanged.

Duration

The durations are four groups of four, 50ms apart up to 600ms and 100ms apart from there:

Classes and tokensDurationsUse
duration-short-1 ... duration-short-4
--md-sys-motion-duration-short1 ... short4
50, 100, 150, 200msSmall utility-focused transitions
duration-medium-1 ... duration-medium-4
--md-sys-motion-duration-medium1 ... medium4
250, 300, 350, 400msTransitions that traverse a medium area of the screen
duration-long-1 ... duration-long-4
--md-sys-motion-duration-long1 ... long4
450, 500, 550, 600msLarge expressive transitions
duration-extra-long-1 ... duration-extra-long-4
--md-sys-motion-duration-extra-long1 ... extra-long4
700, 800, 900, 1000msAmbient transitions that don't involve user input

Tailwind's own transition, transition-colors and the like come with its default duration and easing. Give them one of the theme's duration-* and ease-* classes.

Suggested pairs

Material suggests an easing and a duration for each type of transition, as a starting point:

TransitionEmphasized setStandard set
Begin and end on screenease-emphasized
duration-long-2, 500ms
ease-standard
duration-medium-2, 300ms
Enter the screenease-emphasized-decelerate
duration-medium-4, 400ms
ease-standard-decelerate
duration-medium-1, 250ms
Exit the screenease-emphasized-accelerate
duration-short-4, 200ms
ease-standard-accelerate
duration-short-4, 200ms

Reduced motion

With prefers-reduced-motion, every duration token, a spring's too, is next to nothing, so whatever runs on them is instant. You do not need to add a motion-reduce: class.

  • Tailwind's durations: A transition on one of Tailwind's own durations, such as duration-150, or on its default duration, still runs. Give it one of the theme's durations.
  • Custom durations: A duration of your own must leave the reduced one in place. See Custom motion.

Custom motion

Every easing, duration and spring is a custom property, so your own CSS can set it after the import. A value set before the import is replaced by the theme's.

@import 'tailwindcss';
@import '@material-web/tailwind';

@media (prefers-reduced-motion: no-preference) {
  :root {
    --md-sys-motion-duration-short4: 180ms;
    --md-sys-motion-easing-standard: cubic-bezier(0.3, 0, 0, 1);
  }
}

Set a duration inside the prefers-reduced-motion: no-preference query, as above. A duration set outside it replaces the reduced one too, and the motion then runs for a reader who asked for less.

Easing and duration tokens

The table lists every easing and duration token with its default. For their classes and their use, see Easing and Duration. A token you set changes every class and every component that uses it.

Token and theme variableDefault
--md-sys-motion-easing-standard
--ease-standard
cubic-bezier(0.2, 0, 0, 1)
--md-sys-motion-easing-standard-accelerate
--ease-standard-accelerate
cubic-bezier(0.3, 0, 1, 1)
--md-sys-motion-easing-standard-decelerate
--ease-standard-decelerate
cubic-bezier(0, 0, 0, 1)
--md-sys-motion-easing-emphasized
--ease-emphasized
cubic-bezier(0.2, 0, 0, 1)
--md-sys-motion-easing-emphasized-accelerate
--ease-emphasized-accelerate
cubic-bezier(0.3, 0, 0.8, 0.15)
--md-sys-motion-easing-emphasized-decelerate
--ease-emphasized-decelerate
cubic-bezier(0.05, 0.7, 0.1, 1)
--md-sys-motion-easing-linear
--ease-linear
cubic-bezier(0, 0, 1, 1)
--md-sys-motion-duration-short1
--transition-duration-short-1
50ms
--md-sys-motion-duration-short2
--transition-duration-short-2
100ms
--md-sys-motion-duration-short3
--transition-duration-short-3
150ms
--md-sys-motion-duration-short4
--transition-duration-short-4
200ms
--md-sys-motion-duration-medium1
--transition-duration-medium-1
250ms
--md-sys-motion-duration-medium2
--transition-duration-medium-2
300ms
--md-sys-motion-duration-medium3
--transition-duration-medium-3
350ms
--md-sys-motion-duration-medium4
--transition-duration-medium-4
400ms
--md-sys-motion-duration-long1
--transition-duration-long-1
450ms
--md-sys-motion-duration-long2
--transition-duration-long-2
500ms
--md-sys-motion-duration-long3
--transition-duration-long-3
550ms
--md-sys-motion-duration-long4
--transition-duration-long-4
600ms
--md-sys-motion-duration-extra-long1
--transition-duration-extra-long-1
700ms
--md-sys-motion-duration-extra-long2
--transition-duration-extra-long-2
800ms
--md-sys-motion-duration-extra-long3
--transition-duration-extra-long-3
900ms
--md-sys-motion-duration-extra-long4
--transition-duration-extra-long-4
1000ms

Spring tokens

A spring has four tokens. Each is --md-sys-motion-spring-, the spring's name and one of four endings, as in --md-sys-motion-spring-fast-spatial-duration.

EndingValueUsed by
-durationThe time the spring takes to settleThe spring classes, the presets and the components
-easingThe spring's motion over that time, as a CSS easingThe spring classes, the presets and the components
-damping, -stiffnessThe damping ratio and the stiffness of the springYour own JavaScript. No class or component reads them

Set a spring's duration and easing together. The easing is any CSS easing function: Material lists a cubic-bezier curve for each of its springs.

@media (prefers-reduced-motion: no-preference) {
  :root {
    --md-sys-motion-spring-fast-spatial-duration: 350ms;
    --md-sys-motion-spring-fast-spatial-easing: cubic-bezier(0.42, 1.67, 0.21, 0.9);
  }
}

The table lists every spring token with its default in the two schemes. An easing's default is the spring's curve as a linear() function:

Token and theme variableExpressiveStandard
--md-sys-motion-spring-fast-spatial-duration
--transition-duration-spring-fast-spatial
360ms230ms
--md-sys-motion-spring-fast-spatial-easing
--ease-spring-fast-spatial
A linear() curveAnother linear() curve
--md-sys-motion-spring-fast-spatial-damping0.60.9
--md-sys-motion-spring-fast-spatial-stiffness8001400
--md-sys-motion-spring-default-spatial-duration
--transition-duration-spring-default-spatial
440ms320ms
--md-sys-motion-spring-default-spatial-easing
--ease-spring-default-spatial
A linear() curveAnother linear() curve
--md-sys-motion-spring-default-spatial-damping0.80.9
--md-sys-motion-spring-default-spatial-stiffness380700
--md-sys-motion-spring-slow-spatial-duration
--transition-duration-spring-slow-spatial
600ms490ms
--md-sys-motion-spring-slow-spatial-easing
--ease-spring-slow-spatial
A linear() curveAnother linear() curve
--md-sys-motion-spring-slow-spatial-damping0.80.9
--md-sys-motion-spring-slow-spatial-stiffness200300
--md-sys-motion-spring-fast-effects-duration
--transition-duration-spring-fast-effects
150ms150ms
--md-sys-motion-spring-fast-effects-easing
--ease-spring-fast-effects
A linear() curveThe same curve
--md-sys-motion-spring-fast-effects-damping11
--md-sys-motion-spring-fast-effects-stiffness38003800
--md-sys-motion-spring-default-effects-duration
--transition-duration-spring-default-effects
240ms240ms
--md-sys-motion-spring-default-effects-easing
--ease-spring-default-effects
A linear() curveThe same curve
--md-sys-motion-spring-default-effects-damping11
--md-sys-motion-spring-default-effects-stiffness16001600
--md-sys-motion-spring-slow-effects-duration
--transition-duration-spring-slow-effects
330ms330ms
--md-sys-motion-spring-slow-effects-easing
--ease-spring-slow-effects
A linear() curveThe same curve
--md-sys-motion-spring-slow-effects-damping11
--md-sys-motion-spring-slow-effects-stiffness800800

A spring you set changes its classes, the presets and the components on it:

SpringComponents that use it, such as
fast-spatialButton, switch, radio button, menu
default-spatialBottom sheet, navigation rail, slider
slow-spatialNone
fast-effectsButton, chip, tooltip, menu
default-effectsApp bar, tabs, navigation rail, calendar
slow-effectsBottom sheet
  • Theme variables: Under a token is its Tailwind theme variable, which gives the token its classes. In your own CSS, read the token, as in var(--md-sys-motion-duration-short4): a theme variable has the root's value, and does not follow a data-motion or a token set on an element.
  • Standard scheme: A value set on :root is the root's, in either scheme. To change a spring of the standard scheme alone, set it under [data-motion='standard'].
  • Scheme of your own: Set the springs under a value of your own, such as [data-motion='brisk'], and set that value on the root. A spring you leave out keeps the expressive one.
  • One part of the page: Set an easing or a duration token on an element, in place of the root, to change the motion inside it only.