Kinetik UI

Plan Toggle

.md

A billing-period toggle whose thumb slides and resizes, with a savings badge that pops and a price that rolls.

v1.0.0Live on webreact-native-reanimatedreact-native-worklets
Component preview

Installation

Kinetik CLI
npx kinetik-ui add plan-toggle

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/plan-toggle.json

Install manually

  1. Install dependencies
    npx expo install react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/plan-toggle.tsx
    View source files

Usage

import { PlanPrice, PlanToggle } from '@/components/kinetik/plan-toggle';

<PlanToggle
  accessibilityLabel="Billing period"
  options={[
    { value: 'monthly', label: 'Monthly' },
    { value: 'yearly', label: 'Yearly', badge: 'Save 20%' },
  ]}
  value={period}
  onValueChange={setPeriod}
/>
<PlanPrice amount={period === 'yearly' ? 10 : 12} suffix="/ month" />

The file exports two components: PlanToggle for the period and PlanPrice for a figure that rolls up or down to its new amount. Use them together or apart.

When to use

  • Pricing pages and paywalls with monthly and yearly billing.
  • Any two or three options where one carries a saving worth pointing out.

When not to use

  • More than three options. Use Choice Cards.
  • Settings that are on or off. Use a switch.

Notes

  • The thumb resizes to each option, so labels of different lengths are fine.
  • A badge pops when its option is picked and turns from a tint to solid azure.
  • PlanPrice takes a format function for other currencies, e.g. (a) => new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(a).
  • With reduced motion the thumb jumps and the price changes in place.

Props

PlanToggleProps

PropTypeDefaultDescription
optionsrequiredreadonly PlanToggleOption[]—Two or three billing periods or plan kinds.
valuerequiredstring—
onValueChangerequired(value: string) => void—
accessibilityLabelrequiredstring—Names the toggle, e.g. "Billing period".
hapticsbooleantrueA tick on change. Defaults to true.
testIDstring—
styleStyleProp<ViewStyle>—

PlanPriceProps

PropTypeDefaultDescription
amountrequirednumber—
format(amount: number) => string(a) => `$${Math.round(a)}`Formats the amount. Defaults to whole dollars, e.g. "$12".
suffixstring—After the figure, e.g. "/ month".
textStyleStyleProp<TextStyle>—Style for the figure.
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
Plain views. The thumb moves on two shared values and the price on one; nothing runs at rest.
Measured

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

Real-device measurement pending.

Accessibility

Reduced motion
The thumb jumps, the badge does not pop and the price changes in place.
Screen readers
A radio group; each option reads its label and badge. The price is one text element, e.g. "$14 / month".
Touch target
Options are 44 pt tall.

Source files

components/kinetik/plan-toggle.tsx is in the Code tab of the preview above.