Keyframery

Item

Rows of content that arrive one after another, with one highlight gliding between the rows you can open.

See it as an AI agent does.

Resize preview. Focus the handle and use the left or right arrow keys. Hold Shift for larger steps.— px
Customize1 controls
Animation speed1×

Installation

npx shadcn@latest add @keyframery/item

This adds components/keyframery/item.tsx and its primitive to your project, and installs UI SDK, along with agent-content, which it builds on. The motion tokens are added to your global CSS the first time you install a component.

Usage

import { Item, ItemActions, ItemContent, ItemDescription, ItemTitle } from "@/components/keyframery/item"

export default function Usage() {
  return (
    <Item variant="outline">
      <ItemContent>
        <ItemTitle>Weekly backup</ItemTitle>
        <ItemDescription>Every Sunday at 2am</ItemDescription>
      </ItemContent>
      <ItemActions>On</ItemActions>
    </Item>
  )
}

Anatomy

How the parts fit together:

Item
├── ItemContent
│   ├── ItemTitle
│   └── ItemDescription
└── ItemActions

Examples

An item with an action

Media, a title and a description on the left, whatever the row does on the right.

Inside ItemGroup, rows rendered as links share one highlight that glides to the row under the pointer or the keyboard focus. Rows arrive one after another when the list mounts.

ItemHeader and ItemFooter take a full line above and below the row, for a picture or a status.

Motion

MoveWhat you see
CascadeRows rise out of a soft blur one after another as the list mounts, and the lines between them draw out from the middle.
GlideIn a group, one highlight glides to the row under the pointer or the keyboard focus; the lines beside it step aside.
PressA row that is a link or a button gives a little when pressed and springs back.
FadeA photo in the media slot clears out of a blur as its row arrives.
SpringA chevron in the actions leans toward where the row leads while it is hovered.

Timing and springiness follow the motion style you set. To change how fast this item moves, pass speed:

<Item speed="fast">
  …
</Item>

"fast" is 0.6×, "slow" 1.4×, and a number sets the multiplier. With reduced motion turned on, nothing moves: changes happen at once or with a short fade.

Theming

Set these CSS variables on the component or a parent. Leave them unset to follow the light and dark theme. The open Customize panel below the preview lets you try these settings.

VariableWhat it changesDefault
--item-faceMuted row surfacebg-muted/60
--item-inkRow texttext-foreground
--item-mutedRow detailstext-muted-foreground
--item-radiusRow cornersrounded-[12px]
--item-fontTitle sizetext-[13.5px]
--item-gapRow gapgap-3.5
--item-paddingRow paddingp-3.5

API reference

Every part takes className and children, along with the props of the element it renders. The parts are rendered by UI SDK, so they also take render, to draw your own element, and a function of their state for className and style.

Item

Renders a <div>, and takes its props too.

Prop

Type

ItemMedia

Renders a <div>, and takes its props too.

Prop

Type

ItemSeparator

Renders a <div>, and takes its props too.

Prop

Type

Other parts

These take the props of the element they render, and nothing else:

  • ItemContent: a <div>
  • ItemTitle: a <div>
  • ItemDescription: a <p>
  • ItemActions: a <div>
  • ItemFooter: a <div>
  • ItemGroup: a <div>
  • ItemHeader: a <div>

Keyboard

KeyWhat it does
TabMoves to the next row that is a link or a button; the highlight follows.
EnterOpens the focused row's link or presses its button.

Accessibility

Roles, keyboard and focus are declared on the component's UI SDK primitive, and state is announced through the matching ARIA attributes. More in Accessibility.

Built on UI SDK's core

UI SDK doesn't ship a item, so this one is defined with its core: one definePrimitive in components/keyframery/core/item-core.ts, with no React in it. UI SDK's adapters can render that same definition in Vue, Svelte, Solid and web components. To keep your own styling and take only the motion, import from @/components/keyframery/primitives/item.

Questions

How does the animated Item for UI SDK move?

Cascade: Rows rise out of a soft blur one after another as the list mounts, and the lines between them draw out from the middle. Glide: In a group, one highlight glides to the row under the pointer or the keyboard focus; the lines beside it step aside. Press: A row that is a link or a button gives a little when pressed and springs back. Fade: A photo in the media slot clears out of a blur as its row arrives. Spring: A chevron in the actions leans toward where the row leads while it is hovered.

Do I need Motion or Framer Motion for the animated Item?

No. Every move is plain CSS, so there is nothing to install besides the component and UI SDK.

UI SDK has no item. How is this one built on UI SDK?

Its behaviour is one definition written with UI SDK's core (definePrimitive), in components/keyframery/core/item-core.ts. Its parts are rendered by UI SDK's adapter, so they take render, state-based class names and data-slot, like every UI SDK component.

What happens to the Item when someone turns on reduced motion?

Nothing moves. State changes happen at once, or with a short fade.

All components

On this page