--- title: Number Field description: A numeric input with increment, decrement, and scrub controls. links: doc: https://base-ui.com/react/components/number-field#api-reference --- ## Preview ## Installation CLI Manual ```bash npx @olyx/cli@latest add number-field ``` Install the following dependencies: ```bash npm install @base-ui/react ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx import { NumberField, NumberFieldDecrement, NumberFieldGroup, NumberFieldIncrement, NumberFieldInput, NumberFieldScrubArea, } from "@/components/ui/number-field" ``` ```tsx ``` ## API Reference #### NumberField Root component. Alias for `NumberField.Root` from Base UI. See [Base UI docs](https://base-ui.com/react/components/number-field#api-reference). #### NumberFieldGroup Container for the input and buttons. Alias for `NumberField.Group` from Base UI. #### NumberFieldInput Input element for the number value. Alias for `NumberField.Input` from Base UI. #### NumberFieldIncrement Button to increment the value. Alias for `NumberField.Increment` from Base UI. #### NumberFieldDecrement Button to decrement the value. Alias for `NumberField.Decrement` from Base UI. #### NumberFieldScrubArea Draggable area for adjusting the value. Alias for `NumberField.ScrubArea` from Base UI with a built-in cursor icon. ## Examples For accessible labelling and validation, prefer using the `Field` component to wrap number fields. See the related example: [Number Field](/docs/components/field#number-field). ### With Scrub ### Disabled ### With Range