Kinetik UI

Rotation Ruler

.md

A straighten dial: a ruler of degree ticks slides under a fixed marker and snaps to level.

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

Installation

Kinetik CLI
npx kinetik-ui add rotation-ruler

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/rotation-ruler.json

Install manually

  1. Install dependencies
    npx expo install react-native-gesture-handler react-native-reanimated react-native-worklets
  2. Copy the source files
    • components/kinetik/rotation-ruler.tsx
    View source files

Usage

import { RotationRuler } from '@/components/kinetik/rotation-ruler';

const [angle, setAngle] = useState(0);

<RotationRuler value={angle} onValueChange={setAngle} />;
<Image source={photo} style={{ transform: [{ rotate: `${angle}deg` }] }} />;

When to use

  • Straightening a photo or rotating a layer by small angles.
  • Any bounded angle where feel matters more than typing a number.

When not to use

  • Full turns: a ruler of 360 ticks is slow to sweep. Use a dial or 90° buttons.
  • Values that are not angles.

Notes

  • A flick glides a little before it settles on a whole degree; resting within two degrees of zero snaps to level.
  • Double-tap the ruler to level it. Haptics tick on every degree and land firmer on zero.

Props

RotationRulerProps

PropTypeDefaultDescription
valuerequirednumber—Angle in degrees.
onValueChange(value: number) => void—Called on each whole degree while dragging and as it settles.
onSlidingComplete(value: number) => void—Called once the ruler comes to rest.
minnumber-45Defaults to -45.
maxnumber45Defaults to 45.
spacingnumber8Space between degree ticks, in pt. Defaults to 8.
labelstring'Rotation'Accessible name. Defaults to "Rotation".
disabledbooleanfalse
hapticsbooleantrueA tick on every degree and a firmer one at zero. Defaults to true.
styleStyleProp<ViewStyle>—

Performance and accessibility

Performance

Budget
The tick strip is static views moved by one UI-thread transform; React re-renders once per whole degree.
Measured

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

Real-device measurement pending.

Accessibility

Reduced motion
The ruler follows the finger but does not glide after a flick and settles without a spring.
Screen readers
Adjustable role reading "12 degrees"; increment and decrement move by one degree.
Touch target
The whole 56 pt panel is the touch area.

Source files

components/kinetik/rotation-ruler.tsx is in the Code tab of the preview above.