Keyframery

Animated Autocomplete for UI SDK

Suggestions cascade in under the field and one highlight glides between them as you type.

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/autocomplete

This adds components/keyframery/autocomplete.tsx and its primitive, components/keyframery/primitives/autocomplete.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 {
  Autocomplete,
  AutocompleteArrow,
  AutocompleteClear,
  AutocompleteContent,
  AutocompleteControl,
  AutocompleteEmpty,
  AutocompleteGroup,
  AutocompleteGroupLabel,
  AutocompleteInput,
  AutocompleteItem,
  AutocompleteItemIcon,
  AutocompleteItems,
  AutocompleteItemText,
  AutocompleteLabel,
  AutocompleteList,
  AutocompleteSeparator,
  AutocompleteStatus,
  AutocompleteTrigger,
} from "@/components/keyframery/autocomplete"

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

What moves

MoveWhat you see
UnfoldSuggestions unfold from the field.
CascadeRows arrive one after another.
GlideOne highlight glides between suggestions as you move.
PopThe clear button pops in once there is something to clear.

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 autocomplete with your own styles? Keep your markup and change one line. The primitive adds motion and nothing else.

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

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

Parts

The finished component exports 18 parts:

Autocomplete, AutocompleteArrow, AutocompleteClear, AutocompleteContent, AutocompleteControl, AutocompleteEmpty, AutocompleteGroup, AutocompleteGroupLabel, AutocompleteInput, AutocompleteItem, AutocompleteItemIcon, AutocompleteItems, AutocompleteItemText, AutocompleteLabel, AutocompleteList, AutocompleteSeparator, AutocompleteStatus, AutocompleteTrigger

Accessibility

Keyboard, focus and screen-reader behaviour come from UI SDK and are not changed. With reduced motion turned on, nothing in the autocomplete 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 Autocomplete for UI SDK move?

Unfold: Suggestions unfold from the field. Cascade: Rows arrive one after another. Glide: One highlight glides between suggestions as you move. Pop: The clear button pops in once there is something to clear.

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

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/autocomplete instead. It has the same parts and props as @ui-sdk/react/autocomplete and adds motion only.

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

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

On this page