Keyframery

Marker

A quiet line in a stream whose rules draw out from its words, with a light that sweeps across it while the work it names is still going.

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

This adds components/keyframery/marker.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 { Marker, MarkerContent } from "@/components/keyframery/marker"

export default function Usage() {
  return (
    <Marker variant="separator">
      <MarkerContent>Today</MarkerContent>
    </Marker>
  )
}

Examples

Plain, separator and border

A plain marker is a line of text with an icon; separator puts it between two rules that draw out from the words; border underlines it with a rule that draws from the start.

A status that finishes

live makes the marker a status that screen readers read out. While pending, a light sweeps across the words; when it turns off, the finished text rises in.

Motion

MoveWhat you see
DrawA separator marker's rules draw outward from its words; a border marker's rule draws from the start of the line.
PopThe icon lands with a little overshoot once the work it marks is done.
DirectionThe words rise out of a soft blur; when a pending marker finishes, its new text rises in again.
FadeWhile pending, a light sweeps across the words, then stops when the work is done.

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

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

"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
--marker-inkMarker texttext-muted-foreground
--marker-linkMarker linkstext-foreground
--marker-lineRule colourbg-border
--marker-fontMarker sizetext-[12px]
--marker-gapContent gapgap-2
--marker-icon-sizeMarker iconsize-3.5
--marker-line-widthRule thicknessh-px
--marker-heightMinimum heightmin-h-4

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.

Marker

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

Prop

Type

Other parts

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

  • MarkerContent: a <span>
  • MarkerIcon: a <span>

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 marker, so this one is defined with its core: one definePrimitive in components/keyframery/core/marker-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/marker.

Questions

How does the animated Marker for UI SDK move?

Draw: A separator marker's rules draw outward from its words; a border marker's rule draws from the start of the line. Pop: The icon lands with a little overshoot once the work it marks is done. Direction: The words rise out of a soft blur; when a pending marker finishes, its new text rises in again. Fade: While pending, a light sweeps across the words, then stops when the work is done.

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

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

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

Its behaviour is one definition written with UI SDK's core (definePrimitive), in components/keyframery/core/marker-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 Marker when someone turns on reduced motion?

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

All components

On this page