107 Pro components and page blocks

Get Pro

Updated

Scrub Number

New

Preview

Customize

Sensitivity6px
Acceleration1.00
Fine10
Radius16px

Installation

npx shadcn@latest add https://uibrik.com/r/scrub-number.json
Adds the files to components/uibrik/scrub-number and installs @number-flow/react, @tabler/icons-react and motion. With the @uibrik namespace set up: npx shadcn@latest add @uibrik/scrub-number.

Usage

import { ScrubNumber } from "@/components/uibrik/scrub-number/scrub-number";​<ScrubNumber  label="Width"  sensitivity={6}  acceleration={1}  fine={10}  radius={16}  defaultValue={320}  min={0}  max={1440}  step={1}  suffix="px"  onCommit={(value) => {}}  // value={0}  // onChange={(value) => {}}  // resetValue={0}  // disabled={false}/>

Props

ScrubNumber
sensitivity
Type number
6
Pixels of slow drag per step. Higher is slower and more precise.
acceleration
Type number
1
How much a fast drag speeds up, so large ranges don't need a long drag. Slow drags stay precise. 0 turns it off.
fine
Type number
10
Holding Shift while dragging divides the step by this. Alt with the arrow keys does the same. 1 turns it off.
radius
Type number
16
Corner radius of the field.
labelrequired
Type string
–
Shown on the left; also the input's label.
value / onChange
Type number / (value) => void
–
Controlled value. onChange fires on every step of a drag.
defaultValue
Type number
0
Value on mount when uncontrolled.
onCommit
Type (value) => void
–
Fires once when a drag, arrow key or typed edit settles.
min / max
Type number
–
Limits. The ruler ends at them and the marker stretches a little past before springing back.
resetValue
Type number
defaultValue
Value a double-click or double-tap returns to.
step
Type number
1
Smallest change; also sets the decimals shown.
suffix
Type string
–
Text after the number, e.g. "px", "%" or "°".
disabled
Type boolean
false
Dims the field and ignores input.
className
Type string
–
Classes for the field.