# Introduction
> React components with the motion already designed. A coding agent builds with them from the docs, and an agent in your app can use every control.
Kino is a React component library with motion at its core. Every component moves on the same timing, so the whole app feels like one product.
Every page of these docs comes as Markdown, so your coding agent can read how a component works before it uses one. Once your app runs, an agent on the page can read each Kino control and change it through the component's own API.
Each component's source installs into your project, so every line is yours to change.
## What's in Kino
**Components** for the everyday parts of an app: buttons, menus and dialogs, forms and fields, dates, tables and charts. A component's page has its examples with their full code, its API, and the files its install adds. [Browse the components](https://kinoui.com/docs/components/accordion.md).
**Blocks** are whole screens built from those components, such as a sign-in, a settings page and an app shell. A block installs as parts you arrange, so you keep the ones your app needs. [Browse the blocks](https://kinoui.com/docs/blocks/app-shell.md).
## One motion system
Every movement in Kino plays one of six roles: press, enter, exit, layout, morph and draw. A feel times all six. Pick Calm, Crisp or Lively for the whole app, or for one part of it, and every component changes pace together. [Motion](https://kinoui.com/docs/motion.md) lists the roles and the feels, and shows how to time your own components the same way.
[Density](https://kinoui.com/docs/density.md) and [Shape](https://kinoui.com/docs/shape.md) work the same way. One attribute sets how much room controls take, and another how round the corners are.
## The code is yours
The CLI copies a component into `components/kino/`, and the parts it shares with other components into `lib/`. To change how a component looks or moves, change its file.
Its behaviour, which is the keys, the focus and what a screen reader hears, comes from [ui-sdk](https://ui-sdk.dev), a headless library that the components install as a package. Components move with CSS, so none of them installs an animation library.
The whole library is free, under the MIT licence, and its source is [on GitHub](https://github.com/LGLabGreg/kino).
## An agent can build with it
A page's Markdown holds everything the page shows: each example's code, every part and prop, and the exact files its command adds. Your coding agent can read the page, install the component and use it the way its examples do, without guessing at the API. [Agents](https://kinoui.com/docs/agents.md) covers the Markdown, `llms.txt`, the MCP server, and a few lines for your project's agent rules.
## An agent can use what you build
An agent on your page lists every Kino control by the name a screen reader hears, with its state and what it can do. It changes one through the component's own API, the way a person's click or key would, so it takes no screenshots and simulates no pointer. A task like "rename the project and turn off weekly emails" takes one or two calls.
Your app can approve each step before it runs. A control you mark as one that deletes, pays or sends tells the agent so, and the agent hands it to a person. [Agent bridge](https://kinoui.com/docs/agent-bridge.md) shows how to add it and hand its tools to your model.
## Accessible from the start
Every component follows the WAI-ARIA pattern for its kind of control. It works by keyboard, names its controls for screen readers, shows where focus is in light, dark and high contrast modes, and keeps every state when the system asks for less motion. Layouts also work right to left.
## Try it on this site
Customise, in the header, changes the feel, density, corners, colour, chart colours, icons, theme and direction of every preview on this site. Its Copy setup button gives you the lines that set the same in your project.
## Get started
Add your first component:
[Installation](https://kinoui.com/docs/installation.md) covers what your project needs first, and what the command changes in it.
# Installation
> What your project needs, how the shadcn CLI adds a component, and what it changes in your project.
## Before you start
Kino installs into a React project set up for shadcn/ui: React 19 or later, Tailwind CSS v4, and a `components.json` in the project's root. If you have one, go on to [Add a component](#add-a-component).
To start a new project, follow [shadcn's installation guide](https://ui.shadcn.com/docs/installation) for your framework. Any shadcn project works: each component brings `@ui-sdk/react` with it.
## Add a component
Every component's page has its command, which installs it from its URL:
### The @kino namespace
To add components by name, add the namespace to your project once:
It writes this to `components.json`:
```json
{
"registries": {
"@kino": "https://kinoui.com/r/{name}.json"
}
}
```
Then add any component by its name, several at a time if you like:
## What it adds
- The component's file in `components/kino/`, beside shadcn/ui's `components/ui/`, so Kino never replaces a component you have.
- The parts it shares with other components, in `lib/`, such as `popup.ts` for popovers and `menu.tsx` for menus.
- Its npm packages, such as `@ui-sdk/react`. Components move with CSS, so none of them installs an animation library.
- Kino's `theme` item: rules at the end of your global CSS, for the feels, the density tokens and the shape tokens, and the success and warning colours in your theme. It also adds `lib/reduce-motion.ts`, which tells a component's script when to skip a movement.
The Installation section on each component's page, after the examples, lists exactly what its command adds. When a file is already in your project, the CLI asks before it replaces it.
## Install an example
Every example on a page installs on its own too, so you get exactly what it shows. Its name is the page's, then the example's number, and its command is above its code. The Hero's first example:
It adds one file of your own, such as `components/hero-1.tsx`, which exports the example as `Hero1`, with every Kino component and package it imports. Render it in a page, then change it as you like.
## Global CSS
Each component that moves, or reads Kino's sizes or corners, installs the `theme` item, which adds its rules to the file that `tailwind.css` names in `components.json`. They set how every component moves, how much room it takes, how round its corners are and the colours of success and warning:
- [The feels](https://kinoui.com/docs/motion.md) time each motion role, under `data-feel`. Crisp applies unless you set another.
- [The density tokens](https://kinoui.com/docs/density.md) size controls, rows and surfaces, under `data-density`. Balanced applies unless you set another.
- [The shape tokens](https://kinoui.com/docs/shape.md) round the corners, under `data-shape`. Standard applies unless you set another.
- The status colours, beside shadcn's `--destructive` red: `--success` green and `--warning` amber for icons, fills and tints, and `--success-foreground` and `--warning-foreground` for text in them, in light and dark. The CLI adds them to your theme's `:root` and `.dark`, and as Tailwind colours, such as `text-success`.
Set any of them on ``, or on any element to change one part of a page:
```tsx
```
To change a value, add a rule of your own below Kino's rules:
```css
:root {
--motion-press-scale: 0.95;
}
```
Don't edit Kino's rules themselves, because the CLI writes them again whenever it adds a component that uses them. These are all of them:
```css
@theme inline {
--color-success: var(--success);
--color-success-foreground: var(--success-foreground);
--color-warning: var(--warning);
--color-warning-foreground: var(--warning-foreground);
}
:root {
--success: oklch(0.58 0.14 152);
--success-foreground: oklch(0.46 0.11 152);
--warning: oklch(0.8 0.15 75);
--warning-foreground: oklch(0.54 0.155 45);
}
.dark {
--success: oklch(0.72 0.16 152);
--success-foreground: oklch(0.8 0.13 152);
--warning: oklch(0.8 0.15 75);
--warning-foreground: oklch(0.86 0.12 80);
}
:root, [data-feel='crisp'] {
--motion-press-duration: 400ms;
--motion-press-easing: linear(0, 0.2531, 0.5773, 0.7868, 0.8991, 0.9541, 0.9797, 0.9912, 0.9963, 0.9984, 0.9993, 1, 1);
--motion-press-fade-easing: linear(0, 0.2531, 0.5773, 0.7868, 0.8991, 0.9541, 0.9797, 0.9912, 0.9963, 0.9984, 0.9993, 1, 1);
--motion-enter-duration: 500ms;
--motion-enter-easing: linear(0, 0.1316, 0.3585, 0.5628, 0.7162, 0.8217, 0.8906, 0.934, 0.9607, 0.9769, 0.9865, 0.9922, 0.9955, 0.9974, 0.9985, 0.9992, 1);
--motion-enter-fade-easing: linear(0, 0.1316, 0.3585, 0.5628, 0.7162, 0.8217, 0.8906, 0.934, 0.9607, 0.9769, 0.9865, 0.9922, 0.9955, 0.9974, 0.9985, 0.9992, 1);
--motion-exit-duration: 400ms;
--motion-exit-easing: linear(0, 0.2531, 0.5773, 0.7868, 0.8991, 0.9541, 0.9797, 0.9912, 0.9963, 0.9984, 0.9993, 1, 1);
--motion-exit-fade-easing: linear(0, 0.2531, 0.5773, 0.7868, 0.8991, 0.9541, 0.9797, 0.9912, 0.9963, 0.9984, 0.9993, 1, 1);
--motion-layout-duration: 650ms;
--motion-layout-easing: linear(0, 0.0832, 0.2471, 0.4185, 0.5681, 0.6879, 0.7789, 0.8458, 0.8937, 0.9275, 0.9509, 0.967, 0.978, 0.9853, 0.9903, 0.9936, 0.9958, 0.9972, 0.9982, 0.9988, 0.9992, 1);
--motion-layout-fade-easing: linear(0, 0.0832, 0.2471, 0.4185, 0.5681, 0.6879, 0.7789, 0.8458, 0.8937, 0.9275, 0.9509, 0.967, 0.978, 0.9853, 0.9903, 0.9936, 0.9958, 0.9972, 0.9982, 0.9988, 0.9992, 1);
--motion-morph-duration: 700ms;
--motion-morph-easing: linear(0, 0.0721, 0.2191, 0.3786, 0.5232, 0.6435, 0.7385, 0.8109, 0.8649, 0.9044, 0.9328, 0.9532, 0.9675, 0.9776, 0.9846, 0.9894, 0.9928, 0.9951, 0.9967, 0.9977, 0.9985, 0.999, 1);
--motion-morph-fade-easing: linear(0, 0.0721, 0.2191, 0.3786, 0.5232, 0.6435, 0.7385, 0.8109, 0.8649, 0.9044, 0.9328, 0.9532, 0.9675, 0.9776, 0.9846, 0.9894, 0.9928, 0.9951, 0.9967, 0.9977, 0.9985, 0.999, 1);
--motion-draw-duration: 600ms;
--motion-draw-easing: linear(0, 0.1061, 0.3018, 0.4922, 0.6466, 0.7613, 0.8422, 0.8975, 0.9342, 0.9582, 0.9737, 0.9836, 0.9898, 0.9937, 0.9961, 0.9976, 0.9985, 0.9991, 1, 1);
--motion-draw-fade-easing: linear(0, 0.1061, 0.3018, 0.4922, 0.6466, 0.7613, 0.8422, 0.8975, 0.9342, 0.9582, 0.9737, 0.9836, 0.9898, 0.9937, 0.9961, 0.9976, 0.9985, 0.9991, 1, 1);
--motion-press-scale: 0.97;
}
[data-feel='calm'] {
--motion-press-duration: 500ms;
--motion-press-easing: linear(0, 0.1495, 0.3955, 0.6061, 0.7562, 0.8542, 0.9148, 0.9512, 0.9724, 0.9846, 0.9914, 0.9953, 0.9974, 0.9986, 0.9992, 1, 1);
--motion-press-fade-easing: linear(0, 0.1495, 0.3955, 0.6061, 0.7562, 0.8542, 0.9148, 0.9512, 0.9724, 0.9846, 0.9914, 0.9953, 0.9974, 0.9986, 0.9992, 1, 1);
--motion-enter-duration: 700ms;
--motion-enter-easing: linear(0, 0.0791, 0.2369, 0.4041, 0.5522, 0.6723, 0.7649, 0.8339, 0.884, 0.9198, 0.945, 0.9625, 0.9746, 0.9829, 0.9885, 0.9923, 0.9949, 0.9966, 0.9977, 0.9985, 0.999, 1, 1);
--motion-enter-fade-easing: linear(0, 0.0791, 0.2369, 0.4041, 0.5522, 0.6723, 0.7649, 0.8339, 0.884, 0.9198, 0.945, 0.9625, 0.9746, 0.9829, 0.9885, 0.9923, 0.9949, 0.9966, 0.9977, 0.9985, 0.999, 1, 1);
--motion-exit-duration: 500ms;
--motion-exit-easing: linear(0, 0.1495, 0.3955, 0.6061, 0.7562, 0.8542, 0.9148, 0.9512, 0.9724, 0.9846, 0.9914, 0.9953, 0.9974, 0.9986, 0.9992, 1, 1);
--motion-exit-fade-easing: linear(0, 0.1495, 0.3955, 0.6061, 0.7562, 0.8542, 0.9148, 0.9512, 0.9724, 0.9846, 0.9914, 0.9953, 0.9974, 0.9986, 0.9992, 1, 1);
--motion-layout-duration: 800ms;
--motion-layout-easing: linear(0, 0.0507, 0.1614, 0.2915, 0.4192, 0.5342, 0.6326, 0.714, 0.7796, 0.8317, 0.8723, 0.9038, 0.9279, 0.9462, 0.96, 0.9704, 0.9781, 0.9839, 0.9882, 0.9913, 0.9937, 0.9954, 0.9966, 0.9975, 0.9982, 0.9987, 1);
--motion-layout-fade-easing: linear(0, 0.0507, 0.1614, 0.2915, 0.4192, 0.5342, 0.6326, 0.714, 0.7796, 0.8317, 0.8723, 0.9038, 0.9279, 0.9462, 0.96, 0.9704, 0.9781, 0.9839, 0.9882, 0.9913, 0.9937, 0.9954, 0.9966, 0.9975, 0.9982, 0.9987, 1);
--motion-morph-duration: 850ms;
--motion-morph-easing: linear(0, 0.0471, 0.1512, 0.2754, 0.399, 0.512, 0.6101, 0.6924, 0.7598, 0.814, 0.857, 0.8907, 0.9169, 0.9371, 0.9526, 0.9644, 0.9733, 0.9801, 0.9852, 0.989, 0.9918, 0.9939, 0.9955, 0.9967, 0.9976, 0.9982, 0.9987, 1);
--motion-morph-fade-easing: linear(0, 0.0471, 0.1512, 0.2754, 0.399, 0.512, 0.6101, 0.6924, 0.7598, 0.814, 0.857, 0.8907, 0.9169, 0.9371, 0.9526, 0.9644, 0.9733, 0.9801, 0.9852, 0.989, 0.9918, 0.9939, 0.9955, 0.9967, 0.9976, 0.9982, 0.9987, 1);
--motion-draw-duration: 750ms;
--motion-draw-easing: linear(0, 0.064, 0.1977, 0.3472, 0.4867, 0.6061, 0.7032, 0.7795, 0.838, 0.8821, 0.9148, 0.9389, 0.9564, 0.969, 0.9781, 0.9846, 0.9892, 0.9924, 0.9947, 0.9963, 0.9974, 0.9982, 0.9988, 0.9991, 1);
--motion-draw-fade-easing: linear(0, 0.064, 0.1977, 0.3472, 0.4867, 0.6061, 0.7032, 0.7795, 0.838, 0.8821, 0.9148, 0.9389, 0.9564, 0.969, 0.9781, 0.9846, 0.9892, 0.9924, 0.9947, 0.9963, 0.9974, 0.9982, 0.9988, 0.9991, 1);
--motion-press-scale: 0.98;
}
[data-feel='lively'] {
--motion-press-duration: 450ms;
--motion-press-easing: linear(0, 0.348, 0.8208, 1.0574, 1.0915, 1.0486, 1.0086, 0.9923, 0.9921, 0.9966, 0.9998, 1, 1.0006, 1.0002, 1);
--motion-press-fade-easing: linear(0, 0.348, 0.8208, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
--motion-enter-duration: 400ms;
--motion-enter-easing: linear(0, 0.1858, 0.5115, 0.7844, 0.9515, 1.0272, 1.046, 1.0381, 1.0232, 1.0104, 1.0025, 0.9988, 1);
--motion-enter-fade-easing: linear(0, 0.1858, 0.5115, 0.7844, 0.9515, 1, 1, 1, 1, 1, 1, 1, 1);
--motion-exit-duration: 400ms;
--motion-exit-easing: linear(0, 0.2175, 0.5207, 0.7361, 0.8631, 0.9317, 0.9668, 0.9842, 0.9926, 0.9966, 0.9984, 0.9993, 1);
--motion-exit-fade-easing: linear(0, 0.2175, 0.5207, 0.7361, 0.8631, 0.9317, 0.9668, 0.9842, 0.9926, 0.9966, 0.9984, 0.9993, 1);
--motion-layout-duration: 550ms;
--motion-layout-easing: linear(0, 0.1195, 0.3552, 0.5913, 0.7781, 0.9047, 0.9789, 1.0152, 1.0275, 1.0271, 1.0212, 1.0142, 1.0083, 1.004, 1.0013, 0.9999, 1, 1);
--motion-layout-fade-easing: linear(0, 0.1195, 0.3552, 0.5913, 0.7781, 0.9047, 0.9789, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
--motion-morph-duration: 750ms;
--motion-morph-easing: linear(0, 0.0933, 0.2963, 0.5237, 0.7258, 0.8803, 0.9831, 1.0409, 1.065, 1.0669, 1.0566, 1.0415, 1.0265, 1.0139, 1.0049, 0.9992, 0.9963, 1, 0.9957, 0.9966, 0.9976, 0.9986, 0.9993, 0.9999, 1);
--motion-morph-fade-easing: linear(0, 0.0933, 0.2963, 0.5237, 0.7258, 0.8803, 0.9831, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
--motion-draw-duration: 500ms;
--motion-draw-easing: linear(0, 0.1316, 0.3585, 0.5628, 0.7162, 0.8217, 0.8906, 0.934, 0.9607, 0.9769, 0.9865, 0.9922, 0.9955, 0.9974, 0.9985, 0.9992, 1);
--motion-draw-fade-easing: linear(0, 0.1316, 0.3585, 0.5628, 0.7162, 0.8217, 0.8906, 0.934, 0.9607, 0.9769, 0.9865, 0.9922, 0.9955, 0.9974, 0.9985, 0.9992, 1);
--motion-press-scale: 0.96;
}
:root, [data-density='balanced'] {
--control-height: 2.25rem;
--control-height-xs: 1.5rem;
--control-height-sm: 2rem;
--control-height-lg: 2.5rem;
--control-padding: 0.625rem;
--row-padding: 1rem;
--surface-padding: 1rem;
--surface-padding-lg: 1.25rem;
--surface-gap: 1rem;
}
[data-density='snug'] {
--control-height: 2rem;
--control-height-xs: 1.5rem;
--control-height-sm: 1.75rem;
--control-height-lg: 2.25rem;
--control-padding: 0.5rem;
--row-padding: 0.625rem;
--surface-padding: 0.75rem;
--surface-padding-lg: 1rem;
--surface-gap: 0.75rem;
}
[data-density='airy'] {
--control-height: 2.5rem;
--control-height-xs: 1.75rem;
--control-height-sm: 2.25rem;
--control-height-lg: 2.75rem;
--control-padding: 0.875rem;
--row-padding: 1.25rem;
--surface-padding: 1.25rem;
--surface-padding-lg: 1.5rem;
--surface-gap: 1.25rem;
}
:root, [data-shape='standard'] {
--control-radius: var(--radius-md);
--control-radius-sm: min(var(--radius-md), 10px);
--control-radius-xs: min(var(--radius-md), 8px);
--control-radius-capped: var(--radius-md);
--list-radius: var(--radius-lg);
--item-radius: max(0px, calc(var(--radius-md) - 2px));
--surface-radius: var(--radius-xl);
--surface-radius-lg: var(--radius-2xl);
--mark-radius-share: 0.25;
}
[data-shape='round'] {
--control-radius: 9999px;
--control-radius-sm: 9999px;
--control-radius-xs: 9999px;
--control-radius-capped: 1.25rem;
--list-radius: 1.25rem;
--item-radius: calc(var(--list-radius) - 4px);
--surface-radius: 1.5rem;
--surface-radius-lg: 2rem;
--mark-radius-share: 0.5;
}
@property --scroll-fade-left {
syntax: '*';
inherits: false;
}
@property --scroll-fade-top {
syntax: '*';
inherits: false;
}
@property --scroll-fade-bottom {
syntax: '*';
inherits: false;
}
@property --scroll-fade-right {
syntax: '*';
inherits: false;
}
@property --scroll-fade-start {
syntax: '*';
inherits: false;
}
@property --scroll-fade-end {
syntax: '*';
inherits: false;
}
```
### The ui-sdk layer
ui-sdk, which Kino installs with its components, adds the little CSS its behaviours need, such as keeping a closed popup hidden, in a cascade layer of its own. Declare that layer once, at the very top of the same file, above your Tailwind import, so your own classes always win over it:
```css
@layer ui-sdk;
@import 'tailwindcss';
```
The CLI adds Kino's rules at the end of the file and can't write a line above your imports, so this one is yours to add.
## Icons
Components draw their icons from the library that `iconLibrary` names in `components.json`: Lucide, Tabler, Phosphor, Hugeicons or Remix Icon. The CLI writes each icon from that library when it adds the component.
To switch libraries later, change `iconLibrary`, install the new library's package, and add your components again with `--overwrite`. That replaces any edits you made to their files.
## Install by hand
Each component's Installation section has a Manual tab with every step:
1. Install the npm packages it lists.
2. Copy its files, and the files of the parts it builds on, to the paths shown.
3. Paste the CSS rules at the end of your global CSS, and [the ui-sdk layer](#the-ui-sdk-layer) at its top, once.
The files import from `@/components` and `@/lib`, as shadcn/ui's default aliases do, and draw their icons from Lucide. If your aliases or your icon library differ, change the imports to match. The CLI does both for you.
## Troubleshooting
**The CLI says `Unknown registry "@kino"`.** Your project doesn't have the namespace yet. [Add it](#the-kino-namespace), or install from the URL on the component's page.
**A component has no height, or snaps without moving.** Kino's rules aren't in the CSS your app loads. Check that `tailwind.css` in `components.json` names your global CSS file, then add the component again, or paste [the rules](#global-css) at the end of that file.
**A popup has lost its padding, border or background.** ui-sdk's layer comes after Tailwind's, so its CSS wins over your classes. Add [the layer line](#the-ui-sdk-layer) above your Tailwind import.
**Icons come from the wrong library.** The CLI writes icons when it adds a component, so components added before you changed `iconLibrary` keep the old ones. [Add them again](#icons) with `--overwrite`.
# Agents
> Every page as Markdown, the whole library in one file, and an MCP server, so your agent installs Kino and uses it the way its examples do.
Kino's docs are written for your coding agent as much as for you. A component's page holds the full code of each example, every part and prop, and the exact files its command adds. An agent that reads the page can install the component and use it without guessing at its API.
This page is for the agent that writes your app. For an agent that uses the app once it runs, see [Agent bridge](https://kinoui.com/docs/agent-bridge.md).
## Connect Kino's MCP server
Kino's MCP server lets your agent search Kino, read a page, get an example's code, and check the UI code it writes against Kino's motion and focus rules. It's at `https://kinoui.com/mcp` and needs no key.
In Claude Code:
```bash
claude mcp add --transport http kino https://kinoui.com/mcp
```
In Codex:
```bash
codex mcp add kino --url https://kinoui.com/mcp
```
In Cursor, in `.cursor/mcp.json`:
```json
{
"mcpServers": {
"kino": { "url": "https://kinoui.com/mcp" }
}
}
```
In VS Code, in `.vscode/mcp.json`:
```json
{
"servers": {
"kino": { "type": "http", "url": "https://kinoui.com/mcp" }
}
}
```
An app that takes a remote MCP server as a custom connector, such as Claude, takes the same address. Then ask in plain words, such as "Add a Kino date picker that picks a range". The agent has four tools:
- `search` finds components, blocks and guides by what they do, with the command that adds each one.
- `get_docs` reads a page: a component's parts, props and examples, or a guide such as [Motion](https://kinoui.com/docs/motion.md).
- `get_example` gives one example's full code, and the command that installs it as a file of your project.
- `check_code` checks code the agent wrote: movement timed by Kino's motion roles, with a reduced-motion path, and a focus outline that forced colours can show.
## Give your agent a page
Every page of these docs has a Markdown copy at the same address with `.md` on the end:
```txt
https://kinoui.com/docs/components/dialog.md
```
On any page, Copy page copies its Markdown, and the menu beside it asks ChatGPT or Claude about the page. On a component's page, Copy prompt copies a brief for your agent: what the component does, where its docs are, and the steps to add it to your project.
## Give it the whole library
Two files cover every page at once:
- [`llms.txt`](https://kinoui.com/llms.txt) lists every page with a line on what it covers, so an agent can pick the ones it needs.
- [`llms-full.txt`](https://kinoui.com/llms-full.txt) holds every page in one file, for an agent that reads it all up front.
## Let it search from the command line
Without the MCP server, an agent can search Kino with the shadcn CLI, once your `components.json` has [the @kino namespace](https://kinoui.com/docs/installation.md#the-kino-namespace):
## Tell it how Kino works
Kino's MCP server gives your agent these rules when it connects. For a session without it, paste them into your project's agent rules, such as `AGENTS.md` or `CLAUDE.md`:
```md
## UI components
This project's UI uses Kino (https://kinoui.com). Its components are in
`components/kino/`, and the parts they share are in `lib/`.
- Before building a control, look for it in Kino: `npx shadcn@latest search @kino -q ""`.
Add one with `npx shadcn@latest add @kino/`.
- Read a component's docs before using it: https://kinoui.com/docs/components/.md
(a chart's are at https://kinoui.com/docs/charts/.md).
The examples there show how its parts fit together. Each one also installs on its own, as a file
of this project's, named after the page and the example's number: `npx shadcn@latest add @kino/-`.
- To change how a component looks or behaves, edit its file in `components/kino/`. Don't wrap it.
- Never write a duration, easing or spring of your own. Time any movement with one of Kino's
roles (press, enter, exit, layout, morph, draw):
`duration-(--motion-enter-duration) ease-(--motion-enter-easing)`, with a `motion-reduce:` class
for anything that travels.
- Size controls and surfaces with the density tokens, such as `h-(--control-height)` and
`p-(--surface-padding)`, and round corners with the shape tokens, such as `rounded-(--control-radius)`.
- The feel, density and shape are set with `data-feel`, `data-density` and `data-shape` on ``,
or on one part of a page. Never per component.
```
[Motion](https://kinoui.com/docs/motion.md), [Density](https://kinoui.com/docs/density.md) and [Shape](https://kinoui.com/docs/shape.md) have every role and token these lines name.
# Agent bridge
> Let an AI agent read the components on your page and change them through their own APIs, with your app approving each step.
The `agent` item connects an AI agent to the components on the page. The agent reads each one's name, state and what it can do, then changes it through the component's own API, the way a person's click or key would. It doesn't take screenshots, guess at the page or simulate the pointer, so a task like "rename the project and turn off weekly emails" takes one or two calls.
Kino's controls are built on ui-sdk, so the bridge lists each one on the page. Each component's and block's page ends with For agents: what the bridge lists on its first example, with each one's name, state and actions.
It adds `lib/agent.tsx` and installs ui-sdk's packages. The bridge itself is ui-sdk's, and its agent guide, which ships in the package at `node_modules/@ui-sdk/react/docs/agents.md`, covers every option.
## Render the bridge
Render `AgentBridge` once, near the root of your app. In Next.js, in the root layout:
```tsx
import { AgentBridge } from '@/lib/agent'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
{children}
)
}
```
It renders nothing. The first time it mounts, it creates the page's one bridge, which finds the components already on the page and every one that comes later.
## Hand the tools to your model
The bridge has three tools: `snapshot` lists the components, `act` runs steps on them in order, and `query` finds the choices in a list. `agentTools` describes them with a name, a description and a JSON Schema, the shape model APIs take:
```tsx
import { agentTools, getAgent } from '@/lib/agent'
const tools = agentTools.map(({ name, description, inputSchema }) => ({
name,
description,
input_schema: inputSchema,
}))
async function runTool(name: string, input: unknown) {
const agent = getAgent()
if (!agent) throw new Error('The agent bridge has not mounted yet.')
if (name === 'snapshot') return agent.snapshot()
if (name === 'query') return agent.query(input as Parameters[0])
return agent.act(input as Parameters[0])
}
```
Send `tools` with your request, run each tool call the model makes with `runTool`, and send its result back. A step names a component by the words on the page:
```json
{ "steps": [{ "ref": "Project name", "action": "setValue", "args": ["Atlas"] }] }
```
What the tools return comes from the page, such as a name a user typed, so their descriptions tell the model to treat it as data.
## Approve each step
`allow` decides every step an agent asks for, before it changes anything. Return `true` to let it run, or `false`, or a promise of either, to refuse it:
```tsx
step.component !== 'dialog'} />
```
`allow` is read once, when the bridge is created. A change an agent makes also reaches the component's change callback, as a person's does, with `details.source` set to `'agent'`, so the callback can refuse it with `details.cancel()`.
## Mark what needs a person
A control that deletes, pays or sends carries `data-agent-confirm`, with a sentence that says what it does:
```tsx
```
The agent sees the sentence before it tries. Without an `allow`, a step on the control fails with "Needs a person", and the agent asks the person to press it themselves. With one, the step carries the sentence as `step.confirm`: show it to the person and return their answer. An `allow` that returns `true` without reading `step.confirm` answers yes for them.
`data-agent-secret` keeps a value from the agent: it can still fill the field, and reads `"[redacted]"`. Password, card and one-time-code fields are secret without it. `data-agent-hidden` leaves a whole region out.
## The browser's own agent
Where the browser can host an agent's tools through WebMCP, the bridge registers its three tools with the browser, so an agent built into the browser can use your page too. Its steps go through the same `allow` as your model's, and the components' change callbacks apply to them too. Without an `allow`, its step on a control marked `data-agent-confirm` is refused, and the person presses it themselves. In a browser without WebMCP, nothing is registered.
# Motion
> Every movement in Kino plays one of six roles, and a feel sets the timing of all six. Change the feel and every component changes pace.
## Pick a feel
_A live demo of this is on the page._
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 ``:
```tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
{children}
)
}
```
Or on any element, to change one part of a page:
```tsx
```
A dialog or a popover renders under ``, 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).
| Role | Used for | Calm | Crisp | Lively |
| -------- | ---------------------------------------------------------------- | ------- | ------- | ---------- |
| `press` | A control answering a press: buttons, toggles, thumbs | 0.24, 0 | 0.18, 0 | 0.16, 0.4 |
| `enter` | Something arriving: a menu, a popover, a toast, a new row | 0.36, 0 | 0.26, 0 | 0.24, 0.3 |
| `exit` | Something leaving | 0.24, 0 | 0.18, 0 | 0.2, 0 |
| `layout` | A size or position change: a panel opening, a list reordering | 0.45, 0 | 0.34, 0 | 0.3, 0.25 |
| `morph` | One shape becoming another: a highlight moving to the picked tab | 0.48, 0 | 0.38, 0 | 0.34, 0.35 |
| `draw` | A mark appearing along its length: a checkbox's tick | 0.4, 0 | 0.3, 0 | 0.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.
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--duration`, `--motion--easing` and `--motion--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.
- What a key does many times a day. A highlight a key moves, such as arrowing through a menu, jumps to its item while the pointer's glides, and the Command menu opens and closes at once.
- Nothing grows out of nothing. What enters or leaves starts from 95% of its size, never from a dot.
## 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 (
{children}
)
}
```
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 ``, 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 (
{children}
)
}
```
# Density
> How much room controls, rows and surfaces take. Pick Snug, Balanced or Airy for the whole app, or for one part of it.
## Pick a density
_A live demo of this is on the page._
The tabs, the rows and the buttons change height and padding together, and text stays the same size.
## Set the density
Components install with the density tokens and use Balanced unless you set another. Put `data-density` on ``:
```tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
{children}
)
}
```
Or on any element, to change one part of a page:
```tsx
```
A dialog or a popover renders under ``, so it takes the page's density, not the density of the element its trigger sits in.
## Tokens
Each density gives every token a size, here in pixels at a 16px root.
| Token | Used for | Snug | Balanced | Airy |
| ---------------------- | ----------------------------------------------------- | ---- | -------- | ---- |
| `--control-height` | A button, an input, a tab list | 32 | 36 | 40 |
| `--control-height-xs` | The smallest control, never under 24 | 24 | 24 | 28 |
| `--control-height-sm` | A small control | 28 | 32 | 36 |
| `--control-height-lg` | A large control | 36 | 40 | 44 |
| `--control-padding` | The space beside a control's label | 8 | 10 | 14 |
| `--row-padding` | Above and below a row, such as an accordion's trigger | 10 | 16 | 20 |
| `--surface-padding` | Inside a popover or a card | 12 | 16 | 20 |
| `--surface-padding-lg` | Inside a dialog | 16 | 20 | 24 |
| `--surface-gap` | Between the blocks of a surface | 12 | 16 | 20 |
The tokens are in your global CSS, one block per density. To change a value, add a rule of your own below them:
```css
[data-density='snug'] {
--control-height: 1.875rem;
}
```
Don't edit the blocks themselves, because adding another Kino component writes them again.
## Use the tokens in your own component
```tsx
function SearchField(props: React.ComponentProps<'input'>) {
return (
)
}
```
# Shape
> How round the corners are. Keep the corners of your radius, or make the whole app round with one attribute.
## Pick a shape
_A live demo of this is on the page._
Round makes every control a pill and gives every surface a soft 24px corner. The rows inside a menu or a list follow its curve, so the corners stay parallel.
## Set the shape
Components install with the shape tokens and use Standard unless you set another. Standard takes every corner from `--radius`, as shadcn's components do. For a round app, put `data-shape` on ``:
```tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
{children}
)
}
```
Or on any element, to change one part of a page. An element that sets its own `--radius` needs `data-shape` too, even `data-shape='standard'`, because the tokens are worked out where `data-shape` is set. A dialog or a popover renders under ``, so it takes the page's shape, not the shape of the element its trigger sits in.
In Customise, Round is the last value of Radius.
## Tokens
Standard gives each token a step of your radius; Round gives it a size, here in pixels at a 16px root.
| Token | Used for | Standard | Round |
| ------------------------- | ------------------------------------------------------------------ | --------------------------- | ----- |
| `--control-radius` | A button, a select's trigger, a tab | `--radius-md` | Pill |
| `--control-radius-sm` | A small control | `--radius-md`, at most 10px | Pill |
| `--control-radius-xs` | The smallest control | `--radius-md`, at most 8px | Pill |
| `--control-radius-capped` | A box that can grow past one line, such as a textarea or a tooltip | `--radius-md` | 20 |
| `--list-radius` | A box of rows or controls, such as a menu | `--radius-lg` | 20 |
| `--item-radius` | A row inside a list, such as a menu item | `--radius-md` less 2px | 16 |
| `--surface-radius` | A popover, a dialog, a toast or a card | `--radius-xl` | 24 |
| `--surface-radius-lg` | The open edge of a sheet or a drawer | `--radius-2xl` | 32 |
| `--mark-radius-share` | How much of a chart bar's thickness its corner may take | A quarter | Half |
The tokens are in your global CSS, one block per shape. To change a value, add a rule of your own below them:
```css
[data-shape='round'] {
--surface-radius: 1.25rem;
}
```
Don't edit the blocks themselves, because adding another Kino component writes them again.
## Use the tokens in your own component
```tsx
function Card(props: React.ComponentProps<'div'>) {
return (
)
}
```
# Accordion
> Sections that open one at a time or several at once, as flat rows or as a card whose open item breaks away.
## Examples
### Default
One section is open at a time. A panel pushes what sits below it, and turns back from where it is when you close it midway.
```tsx
'use client'
import {
Accordion,
AccordionPanel,
AccordionItem,
AccordionTrigger,
} from '@/components/kino/accordion'
const QUESTIONS = [
['refunds', 'Do you offer refunds?', 'Within 30 days of a yearly payment, in full.'],
[
'invoices',
'Where do I find my invoices?',
'Under Settings, Billing, Invoices. Owners also get each one by email.',
],
[
'seats',
'Can I add seats mid-cycle?',
'Yes. A new seat is charged for the days left in the cycle on your next invoice.',
],
] as const
function Questions({ variant }: { variant?: 'default' | 'card' }) {
return (
{QUESTIONS.map(([value, question, answer]) => (
{question}{answer}
))}
)
}
export function Accordion1() {
return
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/accordion-1.json
```
### Card
The items share one card. The open item breaks away from the others, and its plus becomes a minus.
```tsx
'use client'
import {
Accordion,
AccordionPanel,
AccordionItem,
AccordionTrigger,
} from '@/components/kino/accordion'
const QUESTIONS = [
['refunds', 'Do you offer refunds?', 'Within 30 days of a yearly payment, in full.'],
[
'invoices',
'Where do I find my invoices?',
'Under Settings, Billing, Invoices. Owners also get each one by email.',
],
[
'seats',
'Can I add seats mid-cycle?',
'Yes. A new seat is charged for the days left in the cycle on your next invoice.',
],
] as const
function Questions({ variant }: { variant?: 'default' | 'card' }) {
return (
{QUESTIONS.map(([value, question, answer]) => (
{question}{answer}
))}
)
}
export function Accordion2() {
return
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/accordion-2.json
```
### Several open at once
With `multiple`, opening a section leaves the others as they are.
```tsx
'use client'
import {
Accordion,
AccordionPanel,
AccordionItem,
AccordionTrigger,
} from '@/components/kino/accordion'
const CHANNELS = [
['email', 'Email', 'Failed deploys and mentions, as they happen.'],
['slack', 'Slack', 'Everything else, in #checkout.'],
['push', 'Push', 'Nothing between 19:00 and 08:00, or at weekends.'],
] as const
export function Accordion3() {
return (
{CHANNELS.map(([value, title, text]) => (
{title}{text}
))}
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/accordion-3.json
```
### Icons and counts
An icon sits before the title. When something follows the title, wrap the title so it takes the room between them.
```tsx
'use client'
import { BellIcon, CreditCardIcon, UsersIcon } from 'lucide-react'
import {
Accordion,
AccordionPanel,
AccordionItem,
AccordionTrigger,
} from '@/components/kino/accordion'
import { Badge } from '@/components/kino/badge'
const ALERTS = [
['payments', CreditCardIcon, 'Failed payments', 3, 'Three cards were declined today.'],
['invites', UsersIcon, 'Pending invites', 2, 'Two people have not joined yet.'],
['alerts', BellIcon, 'Alerts', 12, 'Twelve alerts fired in the last 24 hours.'],
] as const
export function Accordion4() {
return (
{ALERTS.map(([value, Icon, title, count, text]) => (
{title}{count}{text}
))}
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/accordion-4.json
```
### Disabled
A disabled item fades and stays closed.
```tsx
'use client'
import {
Accordion,
AccordionPanel,
AccordionItem,
AccordionTrigger,
} from '@/components/kino/accordion'
export function Accordion5() {
return (
PlanPro, 12 seats, billed monthly.Single sign-onNeeds the Business plan.InvoicesThe next one is $288 on 1 December.
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/accordion-5.json
```
### Content that changes height
Content that grows or shrinks while its panel is open takes the panel, and the rows below, with it.
```tsx
'use client'
import { type ReactNode, useState } from 'react'
import {
Accordion,
AccordionPanel,
AccordionItem,
AccordionTrigger,
} from '@/components/kino/accordion'
import { Button } from '@/components/kino/button'
const DEPLOYS = [
['Address autocomplete on the shipping step', 'Production', '12m'],
['Apple Pay sheet closes on rotation', 'Preview', '48m'],
['Guest checkout copy', 'Preview', '3h'],
['Promo code field', 'Production', '5h'],
['Tax estimate before address', 'Preview', '1d'],
['Remove the account step for guests', 'Production', '2d'],
['Order summary overflows at 320px', 'Preview', '3d'],
['Saved cards on the payment step', 'Production', '4d'],
] as const
/** Paragraphs and lists in a panel share one rhythm. */
function Prose({ children }: { children: ReactNode }) {
return
{children}
}
/** A list that grows and shrinks while its panel is open. */
export function Deploys() {
const [all, setAll] = useState(false)
const rows = all ? DEPLOYS : DEPLOYS.slice(0, 3)
return (
The checkout project deployed {DEPLOYS.length} times this week.
{rows.map(([name, target, when]) => (
{name}{target}{when}
))}
)
}
export function Accordion6() {
return (
This week’s deploysUsage
61% of this month’s build minutes, with 9 days to go.
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/accordion-6.json
```
## Installation
```bash
npx shadcn@latest add https://kinoui.com/r/accordion.json
```
The command adds:
- Files: `lib/refs.ts`, `lib/reduce-motion.ts`, `lib/resize.ts`, `lib/scroll.ts`, `components/kino/accordion.tsx`
- Packages: `@ui-sdk/core`, `@ui-sdk/react`, `class-variance-authority`
- Rules at the end of the global CSS: the feels, the density tokens, the shape tokens and the success and warning colours
## API reference
### Accordion
Groups the items and holds which are open. Other props go to [ui-sdk's Accordion](https://ui-sdk.dev/docs/react/components/accordion#accordion), such as `keepMounted` and `collapsible`.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `'default' \| 'card'` | `'default'` | Flat rows, or one card whose open item breaks away. |
| `heading` | `'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6'` | `'h3'` | The level of the heading each trigger sits in: one under the heading above the accordion. |
| `multiple` | `boolean` | `false` | Lets several items be open at once. |
| `defaultValue` | `any[]` | | The values of the items open at first, when you leave the state to the accordion. An array, also when only one can be open. |
| `value` | `any[]` | | The values of the open items, when you hold the state. |
| `onValueChange` | `(value, details) => void` | | Called when an item is about to open or close. `details.reason` says why, and `details.cancel()` keeps it as it is. |
| `disabled` | `boolean` | `false` | Disables every item. |
| `hiddenUntilFound` | `boolean` | `false` | Lets the browser's find in page search closed panels and open the one it lands on. Chromium and Firefox support it. |
### AccordionItem
One section: a trigger and its panel. Other props go to [ui-sdk's AccordionItem](https://ui-sdk.dev/docs/react/components/accordion#accordionitem).
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `any` | | What names the item in `value` and `defaultValue`. |
| `disabled` | `boolean` | `false` | Fades the item and keeps it as it is. |
### AccordionTrigger
The header you press, inside an `h3`, with the indicator at its end. Other props go to [ui-sdk's AccordionTrigger](https://ui-sdk.dev/docs/react/components/accordion#accordiontrigger).
### AccordionPanel
What the item shows when open. Other props go to [ui-sdk's AccordionPanel](https://ui-sdk.dev/docs/react/components/accordion#accordionpanel).
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | | Goes on the box with the padding, the one you lay out. |
| `keepMounted` | `boolean` | `false` | Keeps the content in the page while the item is closed. |
### Data attributes
| Attribute | On | Description |
| --- | --- | --- |
| `data-open` | `AccordionItem`, `AccordionTrigger`, `AccordionPanel` | Present while the item is open. |
| `data-disabled` | `AccordionItem`, `AccordionTrigger`, `AccordionPanel` | Present while the item is disabled. |
| `data-variant` | `Accordion` | `default` or `card`. |
### CSS variables
| Variable | On | Default | Description |
| --- | --- | --- | --- |
| `--accordion-gap` | `Accordion`, or anything above it | `0.5rem` | The gap around the open item in the card variant. |
## Accessibility
- Tab moves from one header to the next, and Enter or Space opens or closes the focused one.
- Each header is an `h3`.
- With one item open at a time, opening an item closes the one above it, which could carry the header you pressed out of view. The accordion holds that header at the top edge while the page scrolls under it. Under a sticky header, set `scroll-padding-top` on the scroller, or `scroll-margin-top` on the triggers, to the header's height.
- When the system asks for less motion, a panel opens and closes at once, the indicator and the card jump to their place, and content still fades.
## For agents
What an agent reads on this example with `snapshot()`, and the actions it can call with `act()`.
| Name | Component | State | Actions |
| --- | --- | --- | --- |
| | `accordion` | value: []; items: Do you offer refunds? · Where do I find my invoices? · Can I add seats mid-cycle?; buttons: Do you offer refunds? · Where do I find my invoices? · Can I add seats mid-cycle? | `setValue`, `open`, `close`, `toggle`, `openAll`, `closeAll` |
The [Agent bridge](https://kinoui.com/docs/agent-bridge.md) page sets up `snapshot()` and `act()` in your app.
# Alert dialog
> A dialog that asks for confirmation before an action that is hard to undo. A click outside makes it swell instead of closing it.
## Examples
### Default
It rises into the centre like the Dialog. A press outside makes it swell instead of closing it, and focus starts on Cancel.
```tsx
'use client'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/kino/alert-dialog'
import { Button } from '@/components/kino/button'
export function AlertDialog1() {
return (
}>
Remove member
Remove Kenji Watanabe?
They lose access to Checkout at once. Their issues and comments stay.
Cancel
Remove member
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-dialog-1.json
```
### Badge
With `variant='badge'` the question sits centred under an icon in `AlertDialogMedia`, and the answers stack.
```tsx
'use client'
import { Trash2Icon } from 'lucide-react'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogMedia,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/kino/alert-dialog'
import { Button } from '@/components/kino/button'
export function AlertDialog2() {
return (
}>
Discard changes
Discard your changes?
The 3 fields you edited go back to what they were.
Keep editing
Discard
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-dialog-2.json
```
### An action that takes time
Return a promise from `action`: the dialog stays open with a spinner until it settles, and stays open when it rejects. This one fails once.
```tsx
'use client'
import { useRef, useState } from 'react'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogError,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/kino/alert-dialog'
import { Button } from '@/components/kino/button'
const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
export function AlertDialog3() {
const [error, setError] = useState('')
const failed = useRef(false)
return (
open && setError('')}>
}>
Delete project
Delete Checkout?
Its issues, deploys and comments are deleted for everyone.
{error}Cancel {
setError('')
await wait(1500)
if (!failed.current) {
failed.current = true
setError('2 deploys are still running. Stop them, then try again.')
throw new Error('Deploys are running')
}
failed.current = false
}}
>
{error ? 'Try again' : 'Delete project'}
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-dialog-3.json
```
### Type to confirm
For the highest stakes, ask for the name in `AlertDialogBody`, start focus there with `initialFocus`, and allow the action once it matches.
```tsx
'use client'
import { useRef, useState } from 'react'
import {
AlertDialog,
AlertDialogAction,
AlertDialogBody,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from '@/components/kino/alert-dialog'
import { Button } from '@/components/kino/button'
import { Field, FieldLabel } from '@/components/kino/field'
import { Input } from '@/components/kino/input'
export function AlertDialog4() {
const [typed, setTyped] = useState('')
const inputRef = useRef(null)
return (
open && setTyped('')}>
}>
Delete project
inputRef.current}>
Delete Checkout?
Its 1,204 issues and 86 deploys are deleted for everyone. This can’t be
undone.
Type kino/checkout to
confirm.
setTyped(event.target.value)}
autoComplete='off'
spellCheck={false}
/>
Cancel
Delete project
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-dialog-4.json
```
### Controlled
Opened with `open`, it needs no trigger, as when a menu item asks first. Focus goes back to what had it before.
```tsx
'use client'
import { useState } from 'react'
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/kino/alert-dialog'
import { Button } from '@/components/kino/button'
export function AlertDialog5() {
const [open, setOpen] = useState(false)
return (
<>
Close 14 tabs?Their pages stay in your history.CancelClose tabs
>
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-dialog-5.json
```
## Installation
```bash
npx shadcn@latest add https://kinoui.com/r/alert-dialog.json
```
The command adds:
- Files: `lib/reduce-motion.ts`, `components/kino/icon-tile.tsx`, `lib/grip.ts`, `lib/refs.ts`, `lib/resize.ts`, `lib/scroll.ts`, `lib/panel.tsx`, `lib/swap.tsx`, `components/kino/spinner.tsx`, `components/kino/button.tsx`, `components/kino/dialog.tsx`, `lib/refuse.ts`, `components/kino/alert-dialog.tsx`
- Packages: `@ui-sdk/core`, `@ui-sdk/react`, `class-variance-authority`
- Rules at the end of the global CSS: the feels, the density tokens, the shape tokens and the success and warning colours
## API reference
### AlertDialog
Groups the parts and holds whether it is open. It is always modal, and a press outside never closes it. While an action runs, Escape and Cancel don't either. Other props go to [ui-sdk's AlertDialog](https://ui-sdk.dev/docs/react/components/alert-dialog#alertdialog).
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | `boolean` | | Whether it is open, when you hold the state. |
| `onOpenChange` | `(open, details) => void` | | Called when it opens or closes. |
### AlertDialogTrigger
The button that opens it. Pass yours with `render`. Other props go to [ui-sdk's AlertDialogTrigger](https://ui-sdk.dev/docs/react/components/alert-dialog#alertdialogtrigger).
### AlertDialogBackdrop
The dim behind the box, which `AlertDialogContent` renders. Opened from a dialog, it leaves the dim to the dialog below. Other props go to [ui-sdk's AlertDialogBackdrop](https://ui-sdk.dev/docs/react/components/alert-dialog#alertdialogbackdrop).
### AlertDialogContent
The Dialog's box, without a close button. Its children can be a function of its state, such as to read the `payload` the trigger that opened it passed. Other props go to [ui-sdk's AlertDialogContent](https://ui-sdk.dev/docs/react/components/alert-dialog#alertdialogcontent).
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `'default' \| 'badge'` | `'default'` | The badge variant centres the header under its media and stacks the actions, on a narrower box. |
| `initialFocus` | `string \| HTMLElement \| function` | `Cancel` | What takes focus when it opens, such as a field to type a name into: an element, a selector inside the box, or a function that returns one. |
| `finalFocus` | `string \| HTMLElement \| function \| 'none'` | | What takes focus when it closes, in place of the trigger. Set it when the action removes the trigger. |
### AlertDialogHeader
Holds the media, the title, the description and the error. A `
`.
### AlertDialogMedia
An Icon tile for an icon, above the title, in the destructive tone with `variant="destructive"`. Hidden from assistive technology, so the title has to say what it means.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `'default' \| 'destructive'` | `'default'` | Its tint. |
### AlertDialogTitle
The question. Long names break anywhere rather than overflow. Other props go to [ui-sdk's AlertDialogTitle](https://ui-sdk.dev/docs/react/components/alert-dialog#alertdialogtitle).
### AlertDialogDescription
What happens if the person goes ahead. Other props go to [ui-sdk's AlertDialogDescription](https://ui-sdk.dev/docs/react/components/alert-dialog#alertdialogdescription).
### AlertDialogError
Why the action failed, in a status region that is there before its text arrives, so the text is announced. Takes no room while empty. A `
`.
### AlertDialogBody
What scrolls when the dialog is taller than the screen, between the header and the footer, as the Dialog's `DialogBody`.
### AlertDialogFooter
Holds the answers: Cancel first, then the action. A `
`.
### AlertDialogCancel
Closes it without doing anything: an outline Button unless `render` says otherwise. It can't be pressed while an action runs. Other props go to [ui-sdk's AlertDialogClose](https://ui-sdk.dev/docs/react/components/alert-dialog#alertdialogclose).
### AlertDialogClose
A button of your own that closes it, unstyled. Pass yours with `render`. Other props go to [ui-sdk's AlertDialogClose](https://ui-sdk.dev/docs/react/components/alert-dialog#alertdialogclose).
### AlertDialogAction
The action, as a Button: its `variant`, `size` and other props go there.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `action` | `(event, details) => void \| (event, details) => Promise` | | Runs when it is pressed. When it returns, the dialog closes. When it returns a promise, the dialog stays open and the button shows a spinner until the promise settles: it closes once it resolves, and stays open when it rejects. A rejection isn’t logged: catch it to show why in `AlertDialogError`. |
### Data attributes
| Attribute | On | Description |
| --- | --- | --- |
| `data-refused` | `AlertDialogContent` | Set while it answers a press outside. |
| `data-variant` | `AlertDialogContent` | `default` or `badge`. |
## Accessibility
- It is an `alertdialog`: focus moves into it and stays there, and a screen reader reads the title and the description when it opens. Give every one an `AlertDialogDescription`, which says what the question is about.
- Focus starts on Cancel, the safe answer, so Enter right after it opens does nothing that can’t be undone. When it closes, focus goes back to the trigger; set `finalFocus` when the action removes it.
- A press outside doesn’t close it. Escape does, except while an action runs, and so does Cancel.
- While an action runs, the action button keeps focus and is announced as busy, and Cancel waits. An error in `AlertDialogError` is announced, and focus stays on the action, ready to try again.
- When the system asks for less motion, it fades in and out where it stands, and at a press outside Cancel lights up instead of the dialog swelling.
## For agents
What an agent reads on this example with `snapshot()`, and the actions it can call with `act()`.
| Name | Component | State | Actions |
| --- | --- | --- | --- |
| Remove member | `button` | | `press` |
| Remove member | `alert-dialog` | open: false | `setOpen`, `press` |
### Once open
| Name | Component | State | Actions |
| --- | --- | --- | --- |
| Remove member | `button` | | `press` |
| Remove Kenji Watanabe? | `alert-dialog` | open: true; text: Remove Kenji Watanabe? · They lose access to Checkout at once. Their issues and comments stay.; buttons: Cancel · Remove member | `setOpen`, `press` |
| Cancel | `button` | | `press` |
| Remove member (Asks a person first) | `button` | confirm: "Remove Kenji Watanabe from Checkout." | `press` |
The [Agent bridge](https://kinoui.com/docs/agent-bridge.md) page sets up `snapshot()` and `act()` in your app.
# Alert
> A message in the page, with an icon for its type, a title, a description and actions. It makes room as it opens or closes, and a change of type rolls its icon to the new one.
## Examples
### Types
Each type has its own icon, so it reads without its colour: `info`, and `success`, `warning` and `error`, which take the success, warning and destructive tints.
```tsx
'use client'
import { Alert, AlertDescription, AlertTitle } from '@/components/kino/alert'
export function Alert1() {
return (
Kino 4.2 is rolling out
Offline edits on iPad reach your workspace this week.
Payment received$1,280 for 16 seats, paid on 12 Nov.
Your card expires on 30 NovUpdate it before then to keep your plan.3 notebooks couldn’t sync
They’re safe on this device and sync again once you’re back online.
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-1.json
```
### Actions
Buttons or links go under the description in `AlertActions`.
```tsx
'use client'
import {
Alert,
AlertActions,
AlertDescription,
AlertTitle,
} from '@/components/kino/alert'
import { Button } from '@/components/kino/button'
export function Alert2() {
return (
Your trial ends in 3 days
Pick a plan to keep your 12 notebooks and the team’s comments.
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-2.json
```
### Close button
`showCloseButton` adds a button that closes it. It shrinks away and what is below moves up; opened again, it grows back.
```tsx
'use client'
import { useState } from 'react'
import { Alert, AlertDescription, AlertTitle } from '@/components/kino/alert'
import { Button } from '@/components/kino/button'
import { Card, CardContent } from '@/components/kino/card'
export function Alert3() {
const [open, setOpen] = useState(true)
return (
{/* No gap in this column: a gap beside the closed alert would stay, and jump as it opens. */}
Notebooks now sort by last edit
Change it from the menu beside each section.
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-3.json
```
### Changing type
A new `type` rolls the icon to the next, so the loading spinner turns into the result, and the box glides to the new text’s height.
```tsx
'use client'
import { useEffect, useState } from 'react'
import {
Alert,
AlertActions,
AlertDescription,
AlertTitle,
} from '@/components/kino/alert'
import { Button } from '@/components/kino/button'
function wait(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
type ImportPhase = 'loading' | 'success' | 'error'
export function Alert4() {
const [phase, setPhase] = useState('success')
const [runs, setRuns] = useState(0)
useEffect(() => {
if (phase !== 'loading') return
let current = true
void wait(1600).then(() => {
if (current) setPhase(runs % 2 === 1 ? 'error' : 'success')
})
return () => {
current = false
}
}, [phase, runs])
const copy = {
loading: {
title: 'Importing 1,240 contacts',
description: 'From contacts.csv. You can keep working meanwhile.',
},
success: {
title: '1,240 contacts imported',
description: 'They’re in People, tagged “Imported 15 Nov”.',
},
error: {
title: 'The import stopped at row 318',
description: 'Row 318 has no email address. Fix it and try again.',
},
}[phase]
return (
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/alert-4.json
```
## Installation
```bash
npx shadcn@latest add https://kinoui.com/r/alert.json
```
The command adds:
- Files: `lib/reduce-motion.ts`, `components/kino/icon-tile.tsx`, `components/kino/spinner.tsx`, `lib/refs.ts`, `lib/resize.ts`, `lib/swap.tsx`, `lib/notice.tsx`, `lib/controllable.ts`, `components/kino/button.tsx`, `components/kino/alert.tsx`
- Packages: `@ui-sdk/core`, `@ui-sdk/react`, `class-variance-authority`
- Rules at the end of the global CSS: the feels, the density tokens, the shape tokens and the success and warning colours
## API reference
### Alert
A `
` around the message, which goes in its children. `className` sets its layout, such as its width. Other props go to it. Closed, it stays in the page as an empty live region: one that opens and closes sits in a column without a `gap`, which would stay beside it and jump as it opens, and takes its space from a margin on what is beside it.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `type` | `'info' \| 'success' \| 'warning' \| 'error' \| 'loading'` | `'info'` | Its kind, which picks its icon, its colour and how soon it is read out. A change rolls the icon and crossfades the colours. |
| `icon` | `ReactNode` | | An icon in place of the type’s own, or `null` for none. |
| `showCloseButton` | `boolean` | `false` | Adds a button at its end that closes it. |
| `open` | `boolean` | | Whether it shows, when you hold it yourself. Opening or closing it after the page has loaded grows or shrinks it, and while it closes it keeps what it last said. |
| `defaultOpen` | `boolean` | `true` | Whether it shows at first, when it holds that itself. |
| `onOpenChange` | `(open, details) => void` | | Called when it is about to close, from its close button or an agent. `details.cancel()` keeps it open. |
### AlertTitle
A `
` for what happened, in a line or two, which names the alert.
### AlertDescription
A `
` for what it means or what to do next. Links in it are underlined.
### AlertActions
A `
` that lays out buttons or links in a row under the description.
### Data attributes
| Attribute | On | Description |
| --- | --- | --- |
| `data-type` | `Alert` | Its type. |
| `data-open` | `Alert` | Present while it shows; `data-closed` once it has closed. |
## Accessibility
- It is a live region from the start, so what it says when it opens, or when its text changes, is read out: an `error` as an alert, at once, and any other type as a status. What it says as the page loads is read where it sits, never announced.
- To announce a message that arrives later, render the alert closed and open it, rather than adding it, so the region is there before its text.
- Its type never relies on colour alone: each one has its icon, and the title says what happened. The icon is hidden from screen readers.
- The close button is named Close. Once the alert has gone, Tab carries on from where it was.
- In forced colours it keeps an outline, so its edge still shows.
## For agents
What an agent reads on this example with `snapshot()`, and the actions it can call with `act()`.
| Name | Component | State | Actions |
| --- | --- | --- | --- |
| Kino 4.2 is rolling out | `collapsible` | open: true; disabled: true | |
| Payment received | `collapsible` | open: true; disabled: true | |
| Your card expires on 30 Nov | `collapsible` | open: true; disabled: true | |
| 3 notebooks couldn’t sync | `collapsible` | open: true; disabled: true | |
The [Agent bridge](https://kinoui.com/docs/agent-bridge.md) page sets up `snapshot()` and `act()` in your app.
# Animated number
> A number that animates to its new value, formatted for its locale. Each changed digit rolls or spins to its new one, or the whole number counts to it.
## Examples
### Default
Each digit that changed rolls to its new one, up when the value grew. Add seats or switch the billing to see the totals follow.
```tsx
'use client'
import { type ComponentProps, type ReactNode, useId, useState } from 'react'
import { AnimatedNumber } from '@/components/kino/animated-number'
import {
Card,
CardAction,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from '@/components/kino/card'
import { Field, FieldLabel } from '@/components/kino/field'
import {
NumberInput,
NumberInputDecrement,
NumberInputGroup,
NumberInputIncrement,
NumberInputControl,
} from '@/components/kino/number-input'
import { Switch } from '@/components/kino/switch'
/** A form's card: its fields sit inside the card's padding, a gap apart. */
export function FormCard({
title,
description,
action,
titleId,
children,
className,
}: {
title: ReactNode
description?: ReactNode
/** At the end of the header's first row, such as a count or a button. */
action?: ReactNode
/** The title's id, for a part the card names. */
titleId?: string
children: ReactNode
className?: string
}) {
return (
{title}
{description ? {description} : null}
{action ? {action} : null}
{children}
)
}
const SEAT_PRICE = { monthly: 14, yearly: 11.5 }
const USD = { style: 'currency', currency: 'USD' } as const
type Variant = ComponentProps['variant']
function BillingScene({ variant }: { variant: Variant }) {
const [seats, setSeats] = useState(12)
const [yearly, setYearly] = useState(true)
const switchId = useId()
const price = yearly ? SEAT_PRICE.yearly : SEAT_PRICE.monthly
const monthly = seats * price
const saved = seats * (SEAT_PRICE.monthly - SEAT_PRICE.yearly) * 12
return (
)
}
export function AnimatedNumber1() {
return
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/animated-number-1.json
```
### Spin
Each digit spins through the digits between, the way an odometer does, so a bigger change travels further.
```tsx
'use client'
import { useState } from 'react'
import { AnimatedNumber } from '@/components/kino/animated-number'
import { Button } from '@/components/kino/button'
import { Card, CardContent } from '@/components/kino/card'
/** New sign-ups come in one press at a time, and sometimes a batch. */
export function AnimatedNumber2() {
const [members, setMembers] = useState(9_806)
return (
Paying members
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/animated-number-2.json
```
### Count
The whole number counts through the values between and never goes past the new one. Pick a range or refresh.
```tsx
'use client'
import { RefreshCwIcon } from 'lucide-react'
import { type ComponentProps, useState } from 'react'
import { AnimatedNumber } from '@/components/kino/animated-number'
import { Button } from '@/components/kino/button'
import { Card, CardContent } from '@/components/kino/card'
import { Toggle, ToggleGroup } from '@/components/kino/toggle'
type Range = '7d' | '30d' | '90d'
const FIGURES: Record = {
'7d': { revenue: 18_420.5, members: 842, conversion: 0.038 },
'30d': { revenue: 76_905.25, members: 3_174, conversion: 0.041 },
'90d': { revenue: 241_380, members: 9_806, conversion: 0.036 },
}
const PERCENT = {
style: 'percent',
minimumFractionDigits: 1,
maximumFractionDigits: 1,
} as const
/** A sale comes in each time Refresh is pressed: the same steps every time, so the demo reads the same. */
const SALES = [129, 48, 1_240, 12.5, 349, 96]
const USD = { style: 'currency', currency: 'USD' } as const
type Variant = ComponentProps['variant']
const figure = (value: number, format?: Intl.NumberFormatOptions) =>
new Intl.NumberFormat('en-US', format).format(value)
function DashboardScene({ variant }: { variant: Variant }) {
const [range, setRange] = useState('30d')
const [sales, setSales] = useState(0)
const [announced, setAnnounced] = useState(false)
const figures = FIGURES[range]
const extra = SALES.slice(0, sales).reduce((sum, sale) => sum + sale, 0)
const tiles = [
{
label: 'Revenue',
value: figures.revenue + extra,
format: { ...USD } as Intl.NumberFormatOptions,
},
{ label: 'Paying members', value: figures.members + sales, format: undefined },
{ label: 'Trial to paid', value: figures.conversion, format: PERCENT },
]
return (
Workspace billing
{
if (!next[0]) return
setRange(next[0] as Range)
setAnnounced(true)
}}
size='sm'
>
7 days30 days90 days
{/* There before the first change, so a new range or refresh is heard once, as its final figures. */}
)
}
export function AnimatedNumber3() {
return
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/animated-number-3.json
```
### Formats
Any `Intl.NumberFormat` options, in any locale: the digits line up on the decimal point, and the currency sits where the locale puts it.
```tsx
'use client'
import { type ComponentProps, Fragment, useState } from 'react'
import { AnimatedNumber } from '@/components/kino/animated-number'
import {
Card,
CardAction,
CardDescription,
CardHeader,
CardSection,
CardTitle,
} from '@/components/kino/card'
import {
Item,
ItemContent,
ItemGroup,
ItemSeparator,
ItemTitle,
} from '@/components/kino/item'
import { Toggle, ToggleGroup } from '@/components/kino/toggle'
const REGIONS = [
{ country: 'Germany', locale: 'de-DE', currency: 'EUR', seat: 12 },
{ country: 'France', locale: 'fr-FR', currency: 'EUR', seat: 12 },
{ country: 'India', locale: 'en-IN', currency: 'INR', seat: 999 },
{ country: 'Egypt', locale: 'ar-EG', currency: 'EGP', seat: 399 },
{ country: 'Israel', locale: 'he-IL', currency: 'ILS', seat: 45 },
{ country: 'Japan', locale: 'ja-JP', currency: 'JPY', seat: 1_800 },
] as const
const REGION_SEATS = 12
type Variant = ComponentProps['variant']
/** One team's price in six markets, each written the way its locale writes money. */
export function RegionScene({ variant }: { variant: Variant }) {
const [period, setPeriod] = useState<'month' | 'year'>('month')
// Two months free on a yearly plan, as on the billing card.
const months = period === 'year' ? 10 : 1
return (
}>
Team plan by region
{REGION_SEATS} seats, billed in local currency
{
if (next[0]) setPeriod(next[0] as 'month' | 'year')
}}
size='sm'
>
MonthlyYearly
{REGIONS.map(({ country, locale, currency, seat }, index) => (
{index > 0 ? : null}
{country}
{locale}
))}
)
}
export function AnimatedNumber4() {
return
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/animated-number-4.json
```
## Installation
```bash
npx shadcn@latest add https://kinoui.com/r/animated-number.json
```
The command adds:
- Files: `lib/number-format.ts`, `lib/reduce-motion.ts`, `lib/refs.ts`, `lib/resize.ts`, `lib/roll.tsx`, `lib/swap.tsx`, `lib/run-progress.ts`, `components/kino/animated-number.tsx`
- Packages: `@ui-sdk/core`, `@ui-sdk/react`
- Rules at the end of the global CSS: the feels, the density tokens, the shape tokens and the success and warning colours
## API reference
### Props
The number, as a `span`. Other props go on it, and [`render`](https://ui-sdk.dev/docs/react/rendering) makes it another element.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `number` | | The number to show. It moves to each new value. |
| `variant` | `"roll" \| "spin" \| "count"` | `"roll"` | How it moves: each changed digit rolls to its new one, spins through the digits between, or the whole number counts through the values between. |
| `locale` | `Intl.LocalesArgument` | `the browser’s` | The locale it is written in. Give one when the page is rendered on the server, so the server and the browser write it the same way. |
| `format` | `Intl.NumberFormatOptions` | | How it is written: a currency, a percentage, a unit, compact, how many decimals. |
### CSS variables
| Variable | On | Default | Description |
| --- | --- | --- | --- |
| `--swap-roll` | `AnimatedNumber`, or anything above it | `0.75em` | How far a sign, currency or unit rolls when it changes (Roll and Spin). |
## Accessibility
- A screen reader hears the value once, as it is written, never the numbers in between. The number drawn on screen is hidden from it and can’t be selected, so a copy gives the value too.
- It isn’t a live region, so a change isn’t announced on its own. Where a change matters, such as a total after an edit, put the value in a `role="status"` region of your own.
- Digits are all one width, so nothing beside the number moves as its digits change, only when it gains or loses one.
- When the system asks for less motion, nothing rolls, spins or counts: Roll fades the new digits in, and Spin and Count show the new value at once.
## For agents
What an agent reads on this example with `snapshot()`, and the actions it can call with `act()`.
| Name | Component | State | Actions |
| --- | --- | --- | --- |
| Seats | `number-input` | value: 12; min: 1; max: 2000; step: 1 | `setValue`, `increment`, `decrement` |
| Bill yearly | `switch` | checked: true; value: "on" | `setChecked` |
The [Agent bridge](https://kinoui.com/docs/agent-bridge.md) page sets up `snapshot()` and `act()` in your app.
# Aspect ratio
> A box that keeps its width-to-height ratio, for an image, a video or a map. A new ratio glides into place, and a class can set another ratio at a breakpoint.
## Examples
### Default
Give it a `ratio`, width over height, and size the picture inside to fill it with `size-full object-cover`.
```tsx
'use client'
import { AspectRatio } from '@/components/kino/aspect-ratio'
export function AspectRatio1() {
return (
Sunrise over the Dolomites, from Lucía’s field notes
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/aspect-ratio-1.json
```
### In a card
In a `Card`’s `CardSection`, the picture runs to the card’s edges and keeps its shape at any width the card takes, so a row of cards lines up.
```tsx
'use client'
import { AspectRatio } from '@/components/kino/aspect-ratio'
import { Badge } from '@/components/kino/badge'
import {
Card,
CardAction,
CardContent,
CardDescription,
CardHeader,
CardLink,
CardSection,
CardTitle,
} from '@/components/kino/card'
export function AspectRatio2() {
return (
CyclesTwo-week loops with a burn-up chart built in.New
12 Nov 2026
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/aspect-ratio-2.json
```
### Ratios
Any ratio, written as width over height. A box taller than the picture crops it with `object-cover`; use `object-contain` to show all of it.
```tsx
'use client'
import { AspectRatio } from '@/components/kino/aspect-ratio'
const RATIOS = [
{ ratio: 1, label: '1 / 1' },
{ ratio: 4 / 3, label: '4 / 3' },
{ ratio: 16 / 9, label: '16 / 9' },
]
export function AspectRatio3() {
return (
{RATIOS.map(({ ratio, label }) => (
{label}
))}
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/aspect-ratio-3.json
```
### Changing
A new `ratio` glides on the `layout` role, and what sits below moves with it.
```tsx
'use client'
import { useId, useState } from 'react'
import { AspectRatio } from '@/components/kino/aspect-ratio'
import { SegmentedControl, SegmentedControlItem } from '@/components/kino/segmented-control'
const SHAPES = { Wide: 16 / 9, Standard: 4 / 3, Square: 1 }
type Shape = keyof typeof SHAPES
export function AspectRatio4() {
const labelId = useId()
const [shape, setShape] = useState('Wide')
return (
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/aspect-ratio-4.json
```
## Installation
```bash
npx shadcn@latest add https://kinoui.com/r/aspect-ratio.json
```
The command adds:
- Files: `lib/reduce-motion.ts`, `components/kino/aspect-ratio.tsx`
- Packages: `@ui-sdk/core`, `@ui-sdk/react`
- Rules at the end of the global CSS: the feels, the density tokens, the shape tokens and the success and warning colours
## API reference
### Props
A `
`, or the element `render` gives, that keeps its ratio whatever its content: content taller than the box overflows it rather than stretching it. Other props go to it.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `ratio` | `number` | `1` | Width over height, such as `16 / 9`. Without it, the box reads `--ratio` from a class, or is square. |
| `render` | `ReactElement \| (props, state) => ReactElement` | | The element it renders as, such as a `
)
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/badge-2.json
```
### Icons
An icon goes before the label and is sized for it. Keep the word: a colour or an icon alone doesn’t say the status to everyone.
```tsx
'use client'
import { CircleCheckIcon, ClockIcon, TriangleAlertIcon } from 'lucide-react'
import { Fragment } from 'react'
import { Badge } from '@/components/kino/badge'
import { Card, CardSection } from '@/components/kino/card'
import {
Item,
ItemActions,
ItemContent,
ItemDescription,
ItemGroup,
ItemSeparator,
ItemTitle,
} from '@/components/kino/item'
import { cn } from '@/lib/utils'
const INVOICES = [
{ id: 'NW-1187', customer: 'Harbour & Pine', amount: '$1,280.00', status: 'Paid' },
{ id: 'NW-1203', customer: 'Lumen Dental', amount: '$865.50', status: 'Due' },
{ id: 'NW-1219', customer: 'Okafor Studio', amount: '$2,410.00', status: 'Overdue' },
] as const
const STATUS = {
Paid: { icon: CircleCheckIcon, className: 'text-success' },
Due: { icon: ClockIcon, className: 'text-muted-foreground' },
Overdue: { icon: TriangleAlertIcon, className: 'text-destructive' },
}
/** Invoices with their status: the word always there, the icon and its colour beside it. */
export function InvoiceScene() {
return (
{INVOICES.map(({ id, customer, amount, status }, index) => {
const { icon: Icon, className } = STATUS[status]
return (
{index > 0 ? : null}
{customer}{id}{amount}
{status}
)
})}
)
}
export function Badge3() {
return
}
```
To install it as a file of your project, with everything it imports:
```bash
npx shadcn@latest add https://kinoui.com/r/badge-3.json
```
### Links
With `render`, a badge is a link (or any element) that darkens on hover and shows a focus ring.
```tsx
'use client'
import { Badge } from '@/components/kino/badge'
import { Card, CardContent } from '@/components/kino/card'
const TAGS = ['Research', 'Interviews', 'Onboarding', 'Q4 planning']
/** A note's tags, each a link to the notes that share it. */
export function Badge4() {
return (
}>
Interview notes: Lumen Dental
Front desk staff book most appointments by phone and copy them into the
calendar at the end of the day.