Change Proposal: Make buttons and form fields share one size scale
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react, storybook, typescript
調査の方向性
Start by reviewing the button and text field guidance pages and component stories mentioned in the proposal, then check the existing theme tokens and wrapped MUI components. The work spans Figma updates, shared size tokens, buttons, fields, dependent components, documentation, stories, and a migration note. Done means the listed controls and components use the proposed size scale and the docs, stories, and migration guidance reflect it.
索引モデルが issue の本文から書いたものです。
説明
What is being proposed?
One size scale for buttons, button groups, toggle buttons, icon buttons and form fields. A button and a field of the same size have the same height, so they line up side by side. Each size also sets the text and label size, and the size of a button placed inside a field.
This replaces #365. The icon button radius will be its own issue.
⚠️ Breaking change. sci-react-ui will release this as a breaking change. Fields with no
sizeget much shorter (56px to 36px), icon buttons get smaller (by up to 8px), toggle buttons get shorter (by up to about 18px), buttons change by about 2px or less, andsize="small"fields get shorter. Apps will look different after upgrading. See "Breaking change" below.
Why is this needed?
- Form fields look big and take valuable screen space: a default text field is 56px tall, and even the small one is 40px.
- Buttons and fields do not line up, and the theme sets no field heights, text sizes or label positions per size, so apps override them one by one.
Today (MUI 7.3.11 defaults with the theme's 16px body text):
| Size | Button | Button text | IconButton | ToggleButton | Field | Field text | Field label |
|---|---|---|---|---|---|---|---|
| small | 30.75px | 13px | 34px | 38.75px | 40px | 16px | 16px resting, 12px shrunk |
| medium | 36.5px | 14px | 40px | 48.5px | 56px | 16px | 16px resting, 12px shrunk |
| large | 42.25px | 15px | 48px | 58.25px | none | none | none |
What will change?
Appearance only. The size prop keeps working, the heights behind each value change, and xsmall, xlarge and xxl are added.
The rule, as in IBM Carbon: a button and a field of the same size are the same height. IconButton is square at the same height. A button or IconButton inside a field is one size below the field.
Field (text field, select, autocomplete)
| Size | Height | Text | Label | Resting | Shrunk | Button inside |
|---|---|---|---|---|---|---|
small |
32px* | 13px* | floating by default | 13px* | 12px | xsmall (28px) |
medium |
36px* | 14px* | floating by default | 14px* | 12px | small (32px) |
large* |
40px | 15px | floating by default | 15px | 12px | medium (36px) |
xlarge* |
48px | 16px | floating by default | 16px | 12px | large (40px) |
xxl* |
56px | 18px* | floating by default | 18px* | 12px | xlarge (48px) |
Button, IconButton, ButtonGroup and ToggleButton (ButtonGroup and ToggleButton use the Button height and text)
| Size | Button | Button text | IconButton |
|---|---|---|---|
xsmall* |
28px | 12px | 28 × 28px |
small |
32px* | 13px | 32 × 32px* |
medium |
36px* | 14px | 36 × 36px* |
large |
40px* | 15px | 40 × 40px* |
xlarge* |
48px | 16px | 48 × 48px |
xxl* |
56px | 18px | 56 × 56px |
* Next to a size name: a new size for that control. Next to a value: differs from today. Button text keeps today's 13, 14 and 15px. xxl keeps today's 56px field height. There is no xsmall field, and xsmall is for buttons only.
- Buttons barely change: 30.75 to 32px, 36.5 to 36px, 42.25 to 40px, the heights #365 proposed. IconButton shrinks (34, 40, 48px to 32, 36, 40px). ToggleButton shrinks the most (38.75, 48.5, 58.25px to 32, 36, 40px), because MUI gives it more padding than Button.
- Default field: a field with no
sizebecomes 36px, down from 56px. xxl: for screens such as login, where a full-width button sits with fields of the same height. It is today's field height, so apps can move to it to keep the current look.xlargeandxxlare only added if a use is confirmed.- In-field buttons: the gap around the button is 2px in fields up to
largeand 4px above, so it always sits on whole pixels. - Labels: the shrunk label is 12px at every size (
--ds-font-size-200), so the shrink scale ranges from about 0.92 atsmallto about 0.67 atxxl. At any size the label can instead go above or beside the field, at 12px. - Icons: the icon inside a button follows the button size, so each size sets its own icon size.
- NumberInput: the
sizeprop and its spinner are a separate issue (issue-numberinput-size.md). - Other scales: shadcn buttons are 24, 28, 32 and 36px with no field rule. Carbon fields are 24, 32, 40 and 48px, with buttons named for the field they pair with.
Order of work:
- Update Figma. Some sizes are already there, the rest need adding, including text, label and icon sizes.
- Write heights, text, label and icon sizes as tokens (for example
--ds-control-height-xs|sm|md|lg|xl|xxl). - Apply them to Button, IconButton, ButtonGroup and ToggleButton (and ToggleButtonGroup).
- Apply them to text fields, selects and autocompletes, including multiline and adornment cases, and re-tune the resting label position per size.
- Update our own components that use buttons and fields, including any that set
sizethemselves (NavbarandScrollableImagesusesize="small"today):VisitInput,ColourSchemeButton,User,NavMenu,Autocomplete,TransferListand the wrapped MUI components.NumberInputis in its own issue. - Update the docs (such as the button and text field guidance pages) and stories to show every size, and add a migration note.
Out of scope, to follow in later issues: chip sizes, tabs (44px minimum height today), menus and others.
Interface changes (if any)
The size values are the same on every control. medium is the default.
// TextField
<TextField size="small" /> // 32px
<TextField /> // medium, 36px
<TextField size="large" /> // 40px
<TextField size="xlarge" /> // 48px
<TextField size="xxl" /> // 56px
// IconButton: square at the same height
<IconButton size="xsmall" /> // 28 x 28px
<IconButton /> // medium, 36 x 36px
<IconButton size="xxl" /> // 56 x 56px
// Button, ButtonGroup and ToggleButton
<Button size="xsmall" /> // 28px
<Button /> // medium, 36px
<Button size="xxl" /> // 56px
<ButtonGroup size="small" /> // buttons inside are 32px
<ToggleButtonGroup size="small" /> // toggle buttons inside are 32px
Open questions
- Is a default that shrinks every field from 56px to 36px acceptable? It answers "fields are too big", but it is the most visible part of the change.
- Are 13, 15 and 18px acceptable? The type tokens are 11, 12, 14 and 16px, so they need new tokens or raw values. At
smallthe label barely shrinks (13 to 12px).
Breaking change?
- Yes
- No
Visible, not a code break: apps with no size prop get much shorter fields, buttons change by about 2px or less, icon buttons shrink by up to 8px, toggle buttons by up to about 18px, and size="small" fields get shorter than before.
Next steps
A maintainer will review this issue.
If accepted, it will be marked as accepted and a PR may then be opened.
- 主要言語
- TypeScript
- スター
- 9
- フォーク
- 4
- 平均マージ
- 5日 15時間
- マージ済み PR(30日)
- 9
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DiamondLightSource/sci-react-ui のほかの issue
-
accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
DiamondLightSource/sci-react-ui#325 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
accepted
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
DiamondLightSource/sci-react-ui#283 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
accepted
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
DiamondLightSource/sci-react-ui#375 ·
メンテナーはふだん 2 日以内に返信
-
accepted
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
DiamondLightSource/sci-react-ui#365 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Add accessible colour set to use in line plots対応中かも @zoharma が 24 日前に担当しました。 オープンaccepted
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
DiamondLightSource/sci-react-ui#357 ·
メンテナーはふだん 2 日以内に返信
DiamondLightSource/sci-react-ui の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vercel-labs/ui#1066 ·
メンテナーはふだん 1 日以内に返信
-
fix(factory-cockpit): display active agent/actor name instead of verbose step name in run card badgeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ranxianglei/billion-context#7597 ·
メンテナーはふだん 1 日以内に返信
-
documentation target:powerpoint
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
tomast1337/PdfLapas#602 ·
メンテナーはふだん 1 日以内に返信
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every run対応中かも @kc9ddi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
TeraSky-OSS/backstage-plugins#228 ·