Skip to main content

Wheel Picker

Wheel Picker is a scrolling control that lets people select one value, such as a measurement or a number of minutes.

Import

import { WheelPicker } from '@vortexlabs/vortex-native';
import type { WheelPickerProps } from '@vortexlabs/vortex-native';

Other links

import { WheelPicker } from "@vortexlabs/vortex-native";
import React from "react";

const sizes = [
  { value: 48, label: "48" },
  { value: 50, label: "50" },
  { value: 52, label: "52" },
  { value: 54, label: "54" },
  { value: 56, label: "56" },
  { value: 58, label: "58" },
];

export const RingSizeWheel = () => {
  const [circumference, setCircumference] = React.useState(54);

  return (
    <WheelPicker
      aria-label="Ring circumference"
      options={sizes}
      value={circumference}
      onChange={setCircumference}
      unit={"mm"}
      loop={false}
      showBand={true}
    />
  );
};

Features

  • Shows five rows and snaps the selected row to the center.
  • Updates when scrolling settles or a row is tapped.
  • Supports a fixed unit label and looping options.
  • Groups several columns with a shared selection band.

Options and Selection

Pass an ordered options array with a unique value and a short label for each row. Store the selection in value and update it in onChange.

Units

Use unit to show a fixed label next to the selected value. Use loop for repeating sequences, such as minutes on a clock.

import { WheelPicker } from "@vortexlabs/vortex-native";
import React from "react";

const minutes = [
  { value: 0, label: "00" },
  { value: 15, label: "15" },
  { value: 30, label: "30" },
  { value: 45, label: "45" },
];

export const MinuteWheel = () => {
  const [minute, setMinute] = React.useState(15);

  return (
    <WheelPicker
      aria-label="Minutes"
      options={minutes}
      value={minute}
      onChange={setMinute}
      unit="min"
      getValueText={(value) => value + " minutes"}
      loop
    />
  );
};

Selection Band

Set showBand={false} to hide the band on a standalone wheel.

Wheel Picker Group

Wrap up to four columns in WheelPickerGroup to give them one selection band. Each wheel still has its own options and selected value.

import { Stack, WheelPicker, WheelPickerGroup } from "@vortexlabs/vortex-native";
import React from "react";

const feetOptions = [
  { value: 4, label: "4" },
  { value: 5, label: "5" },
  { value: 6, label: "6" },
  { value: 7, label: "7" },
];
const inchOptions = Array.from({ length: 12 }, (_, value) => ({ value, label: String(value) }));

export const HeightWheels = () => {
  const [feet, setFeet] = React.useState(5);
  const [inches, setInches] = React.useState(7);

  return (
    <Stack width={260} maxWidth="100%">
      <WheelPickerGroup>
        <WheelPicker
          aria-label="Feet"
          options={feetOptions}
          value={feet}
          onChange={setFeet}
          unit="ft"
          getValueText={(value) => value + " feet"}
        />
        <WheelPicker
          aria-label="Inches"
          options={inchOptions}
          value={inches}
          onChange={setInches}
          unit="in"
          getValueText={(value) => value + " inches"}
        />
      </WheelPickerGroup>
    </Stack>
  );
};

Use TimePicker to pick a time or duration in a bottom sheet.

Accessibility

Description
Give each column an aria-label that identifies its value, such as “Feet” or “Inches”.
The wheel exposes one adjustable control with increment and decrement actions.
Set getValueText when the visible label or unit abbreviation is unclear when spoken.