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
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>:
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:
<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).
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.
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:
: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:
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:
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> )}