Skip to content

[material-ui][NumberField] Document format prop for units and currency - #49160

Open
Denimworld12 wants to merge 2 commits into
mui:masterfrom
Denimworld12:docs/number-field-format-units-currency
Open

Denimworld12 wants to merge 2 commits into
mui:masterfrom
Denimworld12:docs/number-field-format-units-currency

Conversation

@Denimworld12

Copy link
Copy Markdown

Closes #47666.

Summary

Both variants on the Number Field page spend the input's end adornment on the increment and decrement buttons, so there's no slot left for a unit or currency symbol. Someone coming from TextField reasonably reaches for startAdornment / endAdornment and finds it doesn't work.

format is the supported way to show one — it accepts Intl.NumberFormatOptions, and the demo wrapper spreads {...other} onto NumberField.Root, so it works with the components exactly as documented on this page. Base UI's API reference lists the prop but includes no currency or unit example, which is probably why this wasn't obvious.

This adds a short Units and currency section: two sentences plus a one-line snippet, placed after the two field variants and before the API section.

Following up on @mj12albert's explanation in the issue — the framing here is theirs, I've just written it down. I picked this up per the contributing guide's take-over guidance after the previous claim went ~8 weeks without a PR, and said so on the issue first.

Notes on scope

  • No new demo file. The point is one prop, so prose plus a snippet seemed proportionate to a {{"demo"}} entry with a paired .tsx/.js. Happy to convert it to a real demo if you'd prefer.
  • Decimal precision and step left out deliberately — that's [docs][number field] Number input field precision and decimal step #47657, and a maintainer has already said extensive examples aren't wanted there for now.
  • Verified with prettier@3.9.6 using the repo's docs config (printWidth: 85); the file is clean.
  • Matched the page's existing non-breaking-space convention in "Base UI".

The Number Field page shows two variants that both spend the input's end
adornment on the increment and decrement buttons, so there is no slot left
for a unit or currency symbol. Readers reasonably try `startAdornment` /
`endAdornment` as they would on TextField, and it does not work.

`format` is the supported way to display one: it accepts
`Intl.NumberFormatOptions` and is spread onto `NumberField.Root` by the
demo wrapper, so it works with the components as documented. Base UI's API
reference lists the prop but shows no currency or unit example, which is
likely why this was not obvious.

Adds a short section with prose and a one-line snippet. No new demo file,
and decimal precision / `step` is left out as that is tracked in mui#47657.

Closes mui#47666
@code-infra-dashboard

code-infra-dashboard Bot commented Sep 17, 2026

Copy link
Copy Markdown

Deploy preview

Bundle size

Bundle Parsed size Gzip size
@mui/material 0B(0.00%) 0B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@zannager zannager added the scope: number field Changes related to the number field. label Sep 18, 2026
@zannager
zannager requested a review from siriwatknp September 18, 2026 14:03
Comment thread docs/data/material/components/number-field/number-field.md Outdated
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>

@siriwatknp siriwatknp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: number field Changes related to the number field.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NumberField] Add adornment

3 participants