HomeDocsComponentsBlocksChartsThemes
Introduction
  • Introduction
  • Installation
  • Themes
  • Artwork
  • llms.txt
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Amount
  • Aspect Ratio
  • Audio Player
  • Avatar
  • Avatar Upload
  • Badge
  • Banner
  • Brand SVG
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Cart Button
  • Cart Line Item
  • Cart Summary
  • Chart
  • Checkbox
  • Code Block
  • Collapsible
  • Color Picker
  • Combobox
  • Command
  • Context Menu
  • Copy Button
  • Countdown
  • Data Grid
  • Data Table
  • Date Picker
  • Date Range Picker
  • Description List
  • Device Mockup
  • Dialog
  • Direction
  • Dot Loader
  • Drawer
  • Dropdown Menu
  • Empty
  • Field
  • Fill Blank
  • File Icon
  • File Upload
  • Form Guide
  • Hover Card
  • Icon Tile
  • Image Export
  • Input
  • Input Group
  • Input OTP
  • Item
  • Kanban
  • Kbd
  • Label
  • League Table
  • Marquee
  • Match Score
  • Menubar
  • Meter
  • Multi Select
  • Native Select
  • Navigation Menu
  • Number Field
  • Pagination
  • Password Strength
  • Person Avatar
  • Phone Input
  • Popover
  • Price
  • Product Card
  • Progress
  • Progress Circle
  • Radio Group
  • Rating
  • Resizable
  • Responsive Dialog
  • Rich Text Editor
  • Scroll Area
  • Segmented Control
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature
  • Skeleton
  • Slider
  • Sonner
  • Sortable
  • Spinner
  • Stat
  • Stat Tabs
  • Stepper
  • Switch
  • Table
  • Tabs
  • Tag Input
  • Terminal
  • Textarea
  • Time Field
  • Timeline
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Tree
  • Typography
  • Video Player
  • Window Mockup
AI
  • Message Scroller
  • Message
  • Bubble
  • Marker
  • Attachment
  • Questionnaire
  • Composer
  • Reasoning
  • Tool Call
  • Approval Card
  • Citations
  • Message Toolbar
Blocks
  • Airtable
  • Airtable Kanban
  • CRM
  • ClickUp List
  • ClickUp Kanban
  • Repeatable Group
  • Command Palette
  • App Shell
  • Record Files
  • Settings Shell
  • Help Panel
  • Note Editor
  • Email Drafts
  • Task List
  • Notifications Panel
  • Dual Pane Sidebar
  • Team Members Panel
  • Mix Pack Builder
  • Record Picker and Date Quick-pick
  • Record List
  • Record Page
  • Sign In and Sign Up
  • Availability Scheduler
  • AI Chat
  • AI Assistant
  • Voice Message
  • Action Bar
  • Notion
  • Banking
  • Lineup Builder
  • Sports Score
  • Standings
  • Strava
  • Sheets
  • Notices
  • Settings
  • Billing
Templates
  • Sign In Page
  • Upload Page
  • Showcase Onboarding
  • Agreement Sign
  • Email
  • Email Composer
  • Share Dialog
  • Integrations
  • Transactions
  • Analytics
Utilities
  • motion
  • sounds
  • scroll-fade
  • shimmer
Another UI. Built on shadcn/ui with Phosphor icons.

Number Field

PreviousNext

A number input with minus and plus buttons, keyboard and wheel stepping, bounds, and formatting for currency, percent and units.

UI SDKBase UIReact AriaRadix UI
Radix UI

Between 1 and 99. Hold a button to keep counting.

Up to 50%. Arrow keys step 1%, Shift steps 10%.

Total $254.15

Installation#

pnpm dlx shadcn@latest add https://anotherui.dev/r/number-field.json

Usage#

import { NumberField } from "@/components/ui/number-field"
<NumberField defaultValue={1} min={1} max={99} aria-label="Quantity" />
 
<NumberField
  value={price}
  onValueChange={setPrice}
  min={0}
  step={0.5}
  formatOptions={{ style: "currency", currency: "CAD" }}
/>
 
<NumberField
  defaultValue={0.15}
  min={0}
  max={1}
  step={0.01}
  formatOptions={{ style: "percent" }}
/>

Keyboard#

  • Arrow Up and Arrow Down. Step by step. Hold Shift to step by largeStep.
  • Page Up and Page Down. Step by largeStep, ten steps by default.
  • Home and End. Jump to min and max when they are set.
  • Enter. Commits what was typed. In a form, it still submits.
  • Wheel. Steps only while the field has focus, so the page keeps scrolling.

Props#

  • size. xs, sm, default or lg, the same heights as Button and Input.
  • value, defaultValue, onValueChange. The number, or null when the field is empty. Use it controlled or not.
  • min, max, step. Bounds and step size. Typed values are clamped to the bounds and rounded to the decimals the step or the format shows when the field loses focus. The buttons turn off at the bounds.
  • largeStep. The step for Page Up, Page Down and Shift with an arrow.
  • formatOptions, locale. Passed to Intl.NumberFormat for the value shown when the field is not being edited. With style: "percent" the value is a fraction, so 0.15 shows as 15% and is typed as 15.
  • prefix, suffix. Text or an icon inside the field, beside the number.
  • disabled, readOnly, aria-invalid. Behave like an input. An invalid field gets the destructive ring.
Navigation MenuPagination

On This Page

InstallationUsageKeyboardProps