Motion

Move fast and break nothing. Pick the easing curve and duration that fit what's moving.

Easing
ease-standard
ease-standard-decelerate
ease-standard-accelerate
ease-emphasized-decelerate
ease-emphasized-accelerate

A transition is an easing curve and a duration. Both come with the tokens item, as Tailwind utilities like ease-standard and duration-medium-2, and as variables for your own CSS.

Choosing a curve

Pick the curve by where the element is going:

  • Staying on screen, moving or resizing: ease-standard.
  • Entering: a decelerating curve, so it arrives quickly and settles.
  • Leaving: the same decelerating curve, a step or two shorter. An accelerating curve holds still for most of its time and then snaps, which reads as lag.

ease-emphasized-decelerate is the same idea with more character. Save it for the one element the user should follow, such as a dialog opening, and use ease-standard-decelerate for everything else. The accelerating curves are Material's exit curves; Kappa UI's own components close on the decelerating ones.

Choosing a duration

Pick the duration by how far and how big the change is:

  • short: small changes of state, such as hover and selection.
  • medium: elements expanding or collapsing within the page.
  • long: large surfaces entering or leaving.
  • extra-long: full-screen transitions.

Make an exit a step or two shorter than its entrance.

Entering and leaving

Enter and exit

With Vue's <Transition>, give the entrance and the exit their own curve and duration:

<template>
  <Transition
    enter-active-class="transition duration-medium-2 ease-emphasized-decelerate motion-reduce:transition-none"
    leave-active-class="transition duration-short-3 ease-standard-decelerate motion-reduce:transition-none"
    enter-from-class="translate-y-2 opacity-0"
    leave-to-class="translate-y-2 opacity-0"
  >
    <Notification v-if="open" />
  </Transition>
</template>

motion-reduce:transition-none drops the movement for people who ask their system for less of it. Kappa UI's own motion, the ripple and press scale, already does.

Reading the variables in your own CSS? Give each a fallback: Tailwind only emits a theme variable once something uses it.

.drawer {
  transition: transform var(--transition-duration-long-1, 450ms)
    var(--ease-emphasized-decelerate, cubic-bezier(0.05, 0.7, 0.1, 1));
}

Tokens

VariableDefaultDescription
--ease-standardcubic-bezier(0.2, 0, 0, 1)Movement that starts and ends on screen.
--ease-standard-deceleratecubic-bezier(0, 0, 0, 1)Elements entering the screen.
--ease-standard-acceleratecubic-bezier(0.3, 0, 1, 1)Material's curve for elements leaving the screen. Kappa UI closes on the decelerating curve instead.
--ease-emphasized-deceleratecubic-bezier(0.05, 0.7, 0.1, 1)Prominent entrances, such as a dialog opening.
--ease-emphasized-acceleratecubic-bezier(0.3, 0, 0.8, 0.15)Material's prominent exit. Unused by Kappa UI's components.
--transition-duration-short-1…450–200msSmall changes of state, such as hover and selection. Steps of 50ms.
--transition-duration-medium-1…4250–400msElements expanding or collapsing within the page.
--transition-duration-long-1…4450–600msLarge surfaces entering or leaving.
--transition-duration-extra-long-1…4700–1000msFull-screen transitions.

Next

  • Overlays: menus, selects and dialogs that shut the page.