Skip to content

[TablePagination] Format pagination numbers according to locale#47803

Merged
siriwatknp merged 12 commits intomui:masterfrom
siriwatknp:pagination-format
Mar 13, 2026
Merged

[TablePagination] Format pagination numbers according to locale#47803
siriwatknp merged 12 commits intomui:masterfrom
siriwatknp:pagination-format

Conversation

@siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Feb 18, 2026

Closes #24495

BREAKING CHANGES

TablePagination numbers are formatted by default.

Why

Follow the same approach as MUI X mui/mui-x#13222

Summary

  • Format pagination numbers in TablePagination using Intl.NumberFormat so large numbers display with locale-appropriate separators
  • Add buildFormatNumber utility that creates a locale-bound number formatter
  • Apply formatting to defaultLabelDisplayedRows in TablePagination (en-US) and all 53 active locale files

Before: 103177
After: 103,177 (en-US), 103.177 (de-DE), etc.

Similar to mui/mui-x#21117 for Data Grid.

Test plan

  • TypeScript compiles without errors
  • Existing TablePagination tests pass (72 tests)
  • Verify formatted output with large count values
  • Verify RTL locales (ar-EG, he-IL, etc.) render correctly

Use Intl.NumberFormat to format from/to/count in labelDisplayedRows
so large numbers display with locale-appropriate separators (e.g.
103,177 for en-US, 103.177 for de-DE).
@mui-bot
Copy link

mui-bot commented Feb 18, 2026

Netlify deploy preview

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+175B(+0.03%) 🔺+81B(+0.05%)
@mui/lab 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

Generated by 🚫 dangerJS against f4b5a20

@siriwatknp siriwatknp added breaking change Introduces changes that are not backward compatible. component: TablePagination The React component. v9.x type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Feb 18, 2026
@siriwatknp siriwatknp added this to the Material UI v9 (draft) milestone Feb 18, 2026
@zannager zannager added the scope: pagination Changes related to the pagination. label Feb 18, 2026
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Feb 20, 2026
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged. and removed PR: out-of-date The pull request has merge conflicts and can't be merged. labels Feb 23, 2026
Signed-off-by: Siriwat K <siriwatkunaporn@gmail.com>
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 2, 2026
"labelDisplayedRows": {
"type": { "name": "func" },
"default": "function defaultLabelDisplayedRows({ from, to, count }) {\n return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;\n}"
"default": "function defaultLabelDisplayedRows({ from, to, count }) {\n return `${formatNumber(from)}–${formatNumber(to)} of ${count !== -1 ? formatNumber(count) : `more than ${formatNumber(to)}`}`;\n}"
Copy link
Member

Choose a reason for hiding this comment

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

small nit: if you're reading this doc on the website, this formatNumber looks a bit out of place, but probably not a big deal

Copy link
Member Author

Choose a reason for hiding this comment

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

It's constrain by the api docs script, I don't think we should do it in this PR.

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Can we also add a test?

Copy link
Member

@silviuaavram silviuaavram left a comment

Choose a reason for hiding this comment

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

LGTM with @ZeeshanTamboli comments addressed

@silviuaavram
Copy link
Member

Also, is this ticket is not in our V9 board?

@siriwatknp siriwatknp enabled auto-merge (squash) March 13, 2026 03:36
@siriwatknp
Copy link
Member Author

Also, is this ticket is not in our V9 board?

Added

@siriwatknp siriwatknp merged commit a95a26d into mui:master Mar 13, 2026
23 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Material UI public roadmap Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible. component: TablePagination The React component. scope: pagination Changes related to the pagination. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. v9.x

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[i18n] Format numbers according to locale

6 participants