edbnedbn/ui
ComponentsMapsAudioPDF
GitHub stars
Explorer
Get Started
Components

Number Field

Numeric input with increment/decrement buttons and min/max constraints.

Componentsdocsbase-ui/number-field

Installation

npx shadcn@latest add https://ui.edbn.me/r/number-field.json

Manual

API Reference

Root

Groups all parts of the number field. Renders a div element.

defaultValuenumber | null
=null

Initial value

valuenumber | null

Controlled value

onValueChangefunction

Called when value changes

minnumber
=-Infinity

Minimum value

maxnumber
=Infinity

Maximum value

stepnumber
=1

Step increment

smallStepnumber

Step for Shift+Arrow

largeStepnumber

Step for Page Up/Down

disabledboolean
=false

Disable number field

readOnlyboolean
=false

Read-only state

requiredboolean
=false

Required field

allowWheelScrubboolean
=false

Allow mouse wheel to change value

formatIntl.NumberFormatOptions

Number formatting options

classNamestring | function

CSS class name

renderReactElement | function

Custom render function

Input

The text input for the number field. Renders an input element.

classNamestring | function

CSS class name

renderReactElement | function

Custom render function

Increment

A button that increments the value. Renders a button element.

nativeButtonboolean
=true

Render as native button

classNamestring | function

CSS class name

renderReactElement | function

Custom render function

Increment data attributes
AttributeDescription
data-disabledPresent when button is disabled

Decrement

A button that decrements the value. Renders a button element.

nativeButtonboolean
=true

Render as native button

classNamestring | function

CSS class name

renderReactElement | function

Custom render function

Decrement data attributes
AttributeDescription
data-disabledPresent when button is disabled

ScrubArea

An area that changes the value via click-and-drag. Renders a div element.

direction'horizontal' | 'vertical'
='horizontal'

Scrub direction

pixelsPerScrubnumber
=2

Pixels per scrub step

teleportDistancenumber | null
=null

Teleport cursor distance

classNamestring | function

CSS class name

renderReactElement | function

Custom render function