UIR

EdgeScrubber

A pill on the right edge you drag up and down to pick a value (months by default). It grows while held, the edge swells into a bump, and it snaps with a haptic tick.

Preview

Installation

npx @codewithrabby/ui@latest add edge-scrubber

Usage

import { EdgeScrubber } from "@/components/uir/edge-scrubber";

<View style={{ flex: 1 }}>
  <EdgeScrubber
    inset={{ top: insets.top + 60, bottom: insets.bottom + 80 }}
    onChange={(index, month) => setMonth(month)}
  />
</View>

// any list works
<EdgeScrubber items={["A", "B", "C", "D"]} />

Props

PropTypeDefault
items

Values to scrub through, top to bottom.

string[]MONTHS
initialIndex

Value the pill starts on.

number0
onChange

Called when the snapped value changes.

(index, item) => void—
inset

Space kept free above and below the track.

{ top?, bottom? }{ 40, 40 }
color

Pill and bump colour.

string"#000"
textColor

Text colour in the pill.

string"#fff"
pillWidth

Pill width.

number54
activeScale

How much the pill grows while held.

number1.45
bumpDepth

How far the bump swells in from the edge.

number16
haptics

Haptic tick on every step.

booleantrue