Skip to contentKino
Skip to Content
Docs

Motion

Every component moves in one of six roles, and a feel times all of them. Change the feel and the whole library re-times.

Pick a feel

Feel
A digest at 09:00 on weekdays, to maya@example.com.

When someone writes @you in a comment or a description.

Save the settings, switch tabs and open a row in each feel. Calm is slower and soft, Crisp is quick with no overshoot, and Lively is quicker still and overshoots.

Set the feel

Components install with the feels, in the theme item, and use Crisp unless you set another. Put data-feel on <html>:

tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {  return (    <html lang='en' data-feel='lively'>      <body>{children}</body>    </html>  )}

Or on any element, to change one part of a page:

tsx
<section data-feel='calm'>  <Settings /></section>

A dialog or a popover renders under <body>, so it takes the page's feel, not the feel of the element its trigger sits in. data-feel and data-density work the same way and sit side by side.

Roles

Each feel gives every role a spring: how long it takes to look settled, in seconds, and how far it overshoots (0 for none).

RoleUsed forCalmCrispLively
pressA control answering a press: buttons, toggles, thumbs0.24, 00.18, 00.16, 0.4
enterSomething arriving: a menu, a popover, a toast, a new row0.36, 00.26, 00.24, 0.3
exitSomething leaving0.24, 00.18, 00.2, 0
layoutA size or position change: a panel opening, a list reordering0.45, 00.34, 00.3, 0.25
morphOne shape becoming another: a highlight moving to the picked tab0.48, 00.38, 00.34, 0.35
drawA mark appearing along its length: a checkbox's tick0.4, 00.3, 00.26, 0

A pressed button also shrinks by the feel's press scale, --motion-press-scale: 0.98 in Calm, 0.97 in Crisp and 0.96 in Lively. Icon buttons press deeper, so the press still shows on a small target.

npx shadcn add https://kinoui.com/r/motion.json

Inbox

  • Priya Raman (unread)Contract renewal: the signed copy is attached for your records
  • BillingYour November invoice is ready
  • Tomás Herrera (unread)Can we move Thursday’s design review to Friday morning?
  • SecurityNew sign-in from Firefox on Windows in Lisbon, Portugal

Filter the inbox, archive a message and undo it: each movement is one role, timed by the page's feel.

Change a value

The feels are in your global CSS, one block per feel, as each role's --motion-<role>-duration, --motion-<role>-easing and --motion-<role>-fade-easing, and the press scale. The fade easing is the same curve, held at its end once it gets there: colours fade on it, so an overshoot never carries a colour past where it is going. To change a value, add a rule of your own below them:

css
:root,[data-feel='crisp'] {  --motion-press-scale: 0.95;}

Don't edit the blocks themselves, because adding another Kino component writes them again. The springs they come from are in lib/motion-tokens.ts. Components move with CSS, so a rule like this re-times all of them; a motion element of your own reads the springs in lib/motion-tokens.ts, so change a value there too.

What moves

  • A change, and where it went. A panel opens from its trigger, a highlight travels to the new tab, a row that leaves closes its gap.
  • Exits are faster than entrances, and never overshoot.
  • Colours never overshoot. A button's press can bounce in Lively, but its colour arrives and stays.
  • Transform and opacity first. A component animates its own size only when what sits beside it has to move with it, such as an accordion panel opening.
  • Every movement can be interrupted. Close a menu while it opens and it turns back from where it is.

What never moves

  • A page as it loads. Components appear in place; only things that arrive later, such as a toast, enter.
  • Text someone is reading, and anything for decoration. Nothing loops except a live state, such as a spinner while something loads.

Reduced motion

When the system asks for less motion, movement and size changes are instant and opacity still fades, so every state and result still shows.

Use a role in your own component

With CSS, use the role's variables for the timing, and add a motion-reduce: class for anything that travels:

tsx
function Badge({ children }: { children: React.ReactNode }) {  return (    <span className='animate-in fade-in slide-in-from-bottom-1 duration-(--motion-enter-duration) ease-(--motion-enter-easing) motion-reduce:animate-none'>      {children}    </span>  )}

With motion, add the motion item, which only your own motion elements need, and take the role's transition. It follows the page's feel, the data-feel on <html>, not a data-feel on an element around it:

tsx
import { motion } from 'motion/react'import { useMotionTransition } from '@/lib/motion'function Panel({ children }: { children: React.ReactNode }) {  const transition = useMotionTransition('enter')  return (    <motion.div      initial={{ opacity: 0, y: -8 }}      animate={{ opacity: 1, y: 0 }}      transition={transition}    >      {children}    </motion.div>  )}