• Docs
  • Blog
    • 0.24.0

    • Switch to dark mode
    Get Started
    Components
    Styling
    Theming

    Concepts

    OverviewCompositionTesting

    Layout

    Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

    Components

    AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

    Utilities

    Feature FlagsForLocal StoragePortalShowsplitPropsTheme

    Number Input

    The Number Input component is used to manage numeric input fields.

    • npm
    • source
    • recipe
    • Ark
    import { NumberInput } from '@cerberus/react'

    Usage

    The NumberInput component provides a way to create input fields specifically for numeric values. It includes features such as increment and decrement buttons, and can be easily integrated with form libraries.

    Choose your quantity.

    Scrubber

    The NumberInput supports the scrubber interaction pattern. To use this pattern, use the scrubber prop. It uses the Pointer lock API and tracks the pointer movement. It also renders a virtual cursor which mimics the real cursor's pointer

    Use your mouse wheel to change the value.

    Sizes

    The NumberInput component supports different sizes to accommodate various design requirements. You can specify the size using the size prop.

    Primitives

    You can utilize the primitive components or the css prop to customize the number input.

    ComponentDescription
    NumberInputRootThe context provider for the NumberInput parts
    NumberInputLabelThe label of the NumberInput
    NumberInputControlThe wrapper of the NumberInput contents
    NumberInputInputThe input of the NumberInput
    NumberInputIncrementTriggerThe increment button of the NumberInput
    NumberInputDecrementTriggerThe decrement button of the NumberInput
    NumberInputScrubberThe scrubber of the NumberInput

    API

    Props

    The NumberInput component is an abstraction of the primitives and accepts the following props:

    NameDefaultDescription
    scrubberfalseUse scrubber controls for the number input.

    The NumberInput component also accepts all the props of the NumberInputRoot primitive props

    Parts

    The NumberInputParts API is an Object containing the full family of components.

    Note

    It is best to only use the NumberInputParts if you are building a custom solution. Importing Object based components will ship every property it includes into your bundle, regardless if you use it or not.

    NameDescription
    RootThe NumberInputRoot component which is the Provider for the family.
    LabelThe NumberInputLabel component which displays the label and "required" notice.
    InputThe NumberInputInput component which is the input field.
    ControlThe NumberInputControl component which is the wrapper for the input and buttons.
    IncrementTriggerThe NumberInputIncrementTrigger component which is the increment button.
    DecrementTriggerThe NumberInputDecrementTrigger component which is the decrement button.
    ScrubberThe NumberInputScrubber component which is the scrubber control.

    On this page

    • Edit this page on Github
    Cerberus Design System | Docs