Keyframery

Animated Tree for UI SDK

Branches open on a spring with their rows falling in, and the selected row's key glides.

Part of Keyframery, the open-source animated components for UI SDK

The demo plays by itself. Point at it or press Tab to take over.

Installation

npx shadcn@latest add @keyframery/tree

This adds components/keyframery/tree.tsx and its primitive, components/keyframery/primitives/tree.tsx, to your project, and installs @ui-sdk/react. The motion tokens are added to your global CSS the first time you install a component.

Usage

import {
  Tree,
  TreeGroup,
  TreeItem,
  TreeItemCheckbox,
  TreeItemIndicator,
  TreeItemLabel,
  TreeItems,
} from "@/components/keyframery/tree"

The parts and props are the same as UI SDK's Tree. For every prop, see the UI SDK tree reference.

What moves

MoveWhat you see
GlideThe selected row's key glides to the new row; a lighter highlight follows the pointer.
HeightA branch opens to its real height.
CascadeIts rows fall in one after another, and the chevron turns.

Timing and springiness follow the motion style you set, so this component moves like the rest of your app.

Swap the import

Already using UI SDK's tree with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.

// Before
import { … } from "@ui-sdk/react/tree"

// After: same parts, same props, now animated
import { … } from "@/components/keyframery/primitives/tree"

Parts

The finished component exports 7 parts:

Tree, TreeGroup, TreeItem, TreeItemCheckbox, TreeItemIndicator, TreeItemLabel, TreeItems

Accessibility

Keyboard, focus and screen-reader behaviour come from UI SDK and are not changed. With reduced motion turned on, nothing in the tree moves: changes happen at once or with a short fade. More in Accessibility.

Source

The code that lands in your project. It is yours to change.

Questions

How does the animated Tree for UI SDK move?

Glide: The selected row's key glides to the new row; a lighter highlight follows the pointer. Height: A branch opens to its real height. Cascade: Its rows fall in one after another, and the chevron turns.

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

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

Can I keep my own styling and only take the motion?

Yes. Import from @/components/keyframery/primitives/tree instead. It has the same parts and props as @ui-sdk/react/tree and adds motion only.

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

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

On this page