Blossom UI

Number input

Number input component with plus and minus buttons, arrow keys, min and max, steps, decimals, prefix and suffix.

How to use it

Run npx @blossomui/react add number-input, or copy src/components/UI/NumberInput/NumberInput.tsx into your React project and import it.

import { NumberInput } from './components/ui/NumberInput'

Props

NumberInputLabels

PropTypeDescription
decrease (required)stringAccessible name of the button that lowers the number.
increase (required)stringAccessible name of the button that raises the number.

NumberInputProps

PropTypeDescription
labelsPartial<NumberInputLabels>Texts of the component. Pass only the ones you want to change, for example to translate it.
requiredbooleanMarks the field as required: an asterisk is shown next to the label.
colorstringAccent color of this component: any CSS color. Without it the component uses `--blossom-accent`, which is pink by default.
labelstring
hintstringHelper text shown under the field.
errorstringError message. Turns the field red.
successstringSuccess message. Turns the field green.
valuenumber | nullControlled value, `null` when the field is empty. Use together with `onChange`.
defaultValuenumber | nullInitial value when the field is not controlled.
onChange(value: number | null) => voidCalled with the number, or `null` when the field is emptied.
minnumber
maxnumber
stepnumberHow much the buttons and the arrow keys add or remove. Shift + arrow moves ten steps.
precisionnumberDecimals to show. By default they follow the decimals of `step`.
prefixstringText shown before the number, such as "$".
suffixstringText shown after the number, such as "kg".
localestringFormat the number with the thousands separator of this locale when the field loses focus.
placeholderstring
namestringAdds a name to the input so the number is sent with native forms.
disabledboolean
readOnlyboolean

Getting started

  • Introduction
  • Installation
  • Changelog

Customization

  • Colors
  • Brand color
  • Texts and translation

Components

  • Accordion
  • Alert dialog
  • Alerts
  • Avatar
  • Badges
  • Banner
  • Breadcrumb
  • Buttons
  • Calendar
  • Cards
  • Carousel
  • Charts
  • Chip input
  • Collapsible
  • Color picker
  • Combobox
  • Command palette
  • Context menu
  • Copy button
  • Date picker
  • Drawer
  • Dropdown
  • Empty state
  • File upload
  • Footer
  • Forms
  • Hover card
  • Jumbotron
  • KBD
  • Menubar
  • Modal
  • Navbar
  • Navigation menu
  • Number input
  • OTP input
  • Pagination
  • Popover
  • Pricing
  • Progress
  • Rating
  • Resizable panels
  • Scroll area
  • Segmented control
  • Separator
  • Sidebar
  • Skeleton
  • Slider
  • Spinners
  • Stats
  • Stepper
  • Survey
  • Table
  • Tabs
  • Time picker
  • Timeline
  • Timer button
  • Toasts
  • Tooltip
  • Transfer list
  • Tree