Skip to content
caliper ui pro docs

Shared highlight

A highlight that glides between the items of a list as focus or hover moves.

Pro

When to use

  • Menus, tab strips and lists where one item is active.
  • You want one moving indicator instead of per-row backgrounds.

When not to use

  • The list is long and scrolls; the glide becomes distracting.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/shared-highlight

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.

API reference

SharedHighlight

5 props

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
children *ReactNode—
valuestring—The selected item. Omit for hover-only highlighting.
defaultValuestring | (string & readonly string[])—
onValueChange((value: string) => void)—
asElementType"div"

SharedHighlightItem

7 props
PropTypeDefault
value *string—
asElementType"div"
children *ReactNode—
classNamestring—
onPointerEnter((event: PointerEvent<Element>) => void)—
onFocus((event: FocusEvent<Element, Element>) => void)—
onClick((event: MouseEvent<Element, MouseEvent>) => void)—

Keyboard

  • No custom key handling; Tab and the native activation keys do the work.

Accessibility

It is built on native elements and keeps aria-hidden and aria-current in step with state.

Notes for AI

Give your coding assistant this page as Markdown instead of screenshots: the props, keyboard and examples in one file.

/docs/components/shared-highlight.md

The index of every part is at /llms.txt.

More in Surfaces