ValyroUI Русская версия

Morphing Capsule

Capsule that flows between states. Pro · Effects › Glass

A Liquid Glass capsule that morphs between states — a compact button, an expanded toolbar, a search field — with springy width changes and cross-faded content. Segments that appear split out of their neighbour, and leaving ones merge back into it, through an SVG goo filter like the iOS 26 toolbar and Dynamic Island. Rendered as a toolbar: arrow keys move focus between its controls (not out of text fields), Home/End jump to the ends and Escape returns to the first state. When a state change removes the focused control, focus moves to the first control of the new state.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add morphing-capsule
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { MorphingCapsule } from 'valyro-ui-pro';

Props

PropTypeDefault
states *Record<string, MorphingCapsuleSegment[]>Segments shown in each state, in order. Neighbouring segments merge like liquid while they split or join.
valuestringControlled value; use with onValueChange.
defaultValuestringDefault: the first state.
onValueChange(value: string) => voidCalled with the new value when it changes.
labelstringAccessible name of the toolbar.
size'md' | 'lg''md'Capsule height: 44px or 52px.

Related components

Previous: Glass Lens · Next: Floating Tab Bar · All Effects