Kinetik UI

Morph Icon

.md

An icon button whose glyph reshapes between two states: menu to close, play to pause, plus to check.

v1.0.0Live on web@shopify/react-native-skiareact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add morph-icon

The CLI copies the source and installs native dependencies with npx expo install, so versions match your Expo SDK. With shadcn: npx shadcn@latest add https://kinetik-ui.dev/r/morph-icon.json

Install manually

  1. Install dependencies
    npx expo install @shopify/react-native-skia react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/morph-icon.tsx
    View source files

Usage

import { MorphIcon } from '@/components/kinetik/morph-icon';

<MorphIcon pair="menu-close" accessibilityLabel="Menu" value={open} onValueChange={setOpen} />

<MorphIcon
  pair="play-pause"
  variant="solid"
  accessibilityLabel="Play"
  activeAccessibilityLabel="Pause"
  value={playing}
  onValueChange={setPlaying}
/>

Four pairs ship: menu-close, play-pause, plus-close and plus-check. Leave value unset and the icon keeps its own state.

When to use

  • Controls that flip between two actions in place: play and pause, open and close a menu, add and added.
  • Toolbars and players, where the change of shape is the confirmation and no label is needed.

When not to use

  • Actions that do not reverse. A one-way action is a button, not a toggle.
  • Icons that must stay recognisable at a glance in dense lists. Use a static icon.

Notes

  • Each pair is drawn from strokes matched point for point, so the morph is a blend, not a crossfade. The menu's middle bar folds onto a diagonal instead of fading.
  • Set activeAccessibilityLabel when the action changes (Play / Pause). Without it the button is a toggle with a checked state (Menu, open or not).
  • With reduced motion the glyph switches instantly.

Props

MorphIconProps

PropTypeDefaultDescription
pairrequiredMorphIconPair—The two glyphs the icon moves between: off, then on.
accessibilityLabelrequiredstring—What the button does, e.g. "Menu". With `activeAccessibilityLabel` the label swaps instead ("Play" / "Pause") and the button is not a toggle.
valueboolean—Controlled state. Leave unset to let the icon keep its own.
defaultValuebooleanfalseInitial state when uncontrolled. Defaults to false.
onValueChange(next: boolean) => void—
activeAccessibilityLabelstring—Label while on, for buttons whose action changes rather than toggles.
variant'ghost' | 'soft' | 'solid''soft'`ghost` has no fill, `soft` a quiet one, `solid` an azure disc. Defaults to `soft`.
sizenumber48Diameter of the button. The glyph is half of it. Defaults to 48.
colorstring—Glyph colour. Defaults to the variant's ink.
hapticsbooleantrueA light tap as the state changes. Defaults to true.
disabledbooleanfalse
testIDstring—
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
One tiny Skia canvas. The glyph is rebuilt from a dozen points on the UI thread, and only while it morphs.
Measured

Pixel 9 emulator, API 35, release build · interaction median 1.05× the system Settings app on the same emulator (indicative only) · no frames drawn at rest · 157 MB app memory

Real-device measurement pending.

Accessibility

Reduced motion
The glyph switches without travelling or turning; the press still dips slightly.
Screen readers
A toggle button with a checked state, or a button whose label swaps (Play / Pause) when activeAccessibilityLabel is set.
Touch target
48 pt by default; smaller sizes get a hit slop that makes up 44 pt.

Source files

components/kinetik/morph-icon.tsx is in the Code tab of the preview above.