Kinetik UI

Status Button

.md

A button that folds into a spinner while it works, then opens in green with a traced check, or shakes in red.

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

Installation

Kinetik CLI
npx kinetik-ui add status-button

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/status-button.json

Install manually

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

Usage

import { StatusButton, type ButtonStatus } from '@/components/kinetik/status-button';

const [status, setStatus] = useState<ButtonStatus>('idle');

<StatusButton
  status={status}
  successLabel="Paid"
  onPress={async () => {
    setStatus('loading');
    try {
      await pay();
      setStatus('success');
    } catch {
      setStatus('error');
    }
  }}
>
  Pay $24.00
</StatusButton>;

The button is controlled: you own status. Presses are ignored while loading and after success; an error state can be pressed again to retry. Return to idle when you are ready, for example a couple of seconds after success.

When to use

  • Actions that take a moment and can fail: paying, sending, saving to a server.
  • Places where the result should show where the person is already looking.

When not to use

  • Instant actions. A spinner that flashes for 50 ms reads as a glitch.
  • Long jobs (uploads, exports). Show real progress instead.

Notes

  • Widths are measured from the labels, so the button springs between their natural sizes.
  • A success or error haptic plays when the state changes.
  • With reduced motion the states cross-fade without the spring, spin or shake.

Props

StatusButtonProps

PropTypeDefaultDescription
childrenrequiredstring—Label while idle.
statusrequiredButtonStatus—Drives the button. Set `loading` while work runs, then `success` or `error`.
onPress() => void—
successLabelstring'Done'Label once it worked. Defaults to 'Done'.
errorLabelstring'Try again'Label when it failed. Defaults to 'Try again'.
hapticsbooleantrueHaptics on success and error. Defaults to true.
disabledbooleanfalse
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
Width, colour and icon animations are springs and timings on the UI thread; the spinner's frame callback runs only while loading.
Measured

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

Real-device measurement pending.

Accessibility

Reduced motion
States switch with a short fade: no width spring, spinning or shake.
Screen readers
Button role; its name follows the state (label, 'in progress', success or error label) and is announced politely. Busy while loading.
Touch target
52 pt tall; at least 52 pt wide while loading.

Source files

components/kinetik/status-button.tsx is in the Code tab of the preview above.