mui / mui/base-ui

[number field] Export `useNumberFieldButton` / Increment, Decrement for text input

Open
#1,814 2 comments 3 reactions 0 assignees View on GitHub
component: number field support: question
Dominant language
TypeScript
Stars
10.9k
Forks
543
Avg merge
1d 20h
Merged PRs (30d)
101

Description

# Feature request

## Summary

Based on the now deprecated `@mui/base` package I've created a custom component consisting of a **text** input (which is able to calculate a value on "Enter"-press) and increment/decrement buttons.

In order to achieve the increment/decrement functionality, I've used the useNumberInput-API https://mui.com/base-ui/react-number-input/hooks-api/#use-number-input (`getDecrementButtonProps`, `getIncrementButtonProps`).

https://github.com/user-attachments/assets/4d627ff9-38a2-4841-b330-6d92ac8cf73e

Currently I'm migrating this component to `mui/base-ui` and have some problems, since i can't find that hook anymore. I've discovered `useNumberFieldButton`, which might to possibly do the job - however it doesn't seem to be exported via package.

Image

Is there any possible way to import this hook?
Is it planned to be exported / exposed for the wider usage?

Or is there maybe another way to be able to combine a **text** input with increment / decrement buttons - i've tried the NumberField way https://base-ui.com/react/components/number-field and set type and inputMode to `text` - however it doesn't seem to work that way (duh - it's a number field :D)

Thank you in advance!

## Examples in other libraries

* useNumberInput API at `@mui/base` https://mui.com/base-ui/react-number-input/hooks-api/#use-number-input
(getDecrementButtonProps, getIncrementButtonProps)

## Motivation

* I would like to be able to combine increment / decrement buttons with a text input.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.