Repository navigation
feat(icon button)!: refactor icon button component - #5103
Conversation
# Conflicts: # src/components/IconButton/IconButton.tsx # src/components/IconButton/utils.ts # src/components/TextInput/TextInputIcon.tsx
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
satya164
left a comment
There was a problem hiding this comment.
Review by Claude
- The migration guide (
docs/6.x/docs/guides/migration.md) has no IconButton section for these breaking changes:mode="contained"to"filled"and"contained-tonal"to"tonal", the numericsizereplaced by named sizes,sizeremoved fromAppbar.ActionandAppbar.BackAction,selected={false}now picking the toggle-off colors (for examplefilledturnssurfaceContainerinstead ofprimary), the removed 6dp margin, andCard.Titlerightprops that can no longer be spread intoIconButton. JavaScript users who still passsize={24}get a crash, becauseIconButtonTokens.sizes[24]isundefinedandgetDimensionsreadsspec.widths. Please add before and after snippets for each.
See the inline comments for the rest. (via Claude, verify if it makes sense)
Port main's IconButton changes into the Material 3 Expressive rewrite: - 48dp hit slop via getMinInteractiveSizeHitSlop, with a hitSlop override (none when disabled or without a touch handler) - role prop, and an image role on web for a labelled, handler-less button - touchable fills the container so content stays centered - touchable clips its own ripple, so the hit slop is not clipped - a disabled icon takes the disabled color over iconColor Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Heads-up: #5107 is merged, and it moves every focus ring onto one shared hook,
If the outline now sits outside the touchable, ring the container the way Button does ( |
The branch is 46 commits behind and has conflicts, so it needs a rebase anyway. Regenerate the snapshots afterwards. |
Take main's shared keyboard focus ring (#5107): - drop src/utils/focusRing.ts and take main's FAB, Switch and Checkbox - drop IconButton's own focus state and ring view; the ring now comes from useFocusRing with 'within' on the clip view, so it surrounds the outline and the touchable no longer draws a second one - keep the theme props on IconButton's TouchableRipple and TextInput.Icon - regenerate snapshots, add IconButton focus ring wiring tests Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A disabled filled, tonal or outlined-selected button takes the disabled container color and ignores `containerColor`, as in 5.x. Note it on the prop and in the migration guide, and cover it with a test. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
Two more small things and we are ready to merge:
|
Stoneski93
left a comment
There was a problem hiding this comment.
Checked against the M3 spec: sizes, shapes, colors and touch target match. The color, spring and test ID fixes look good.
Open (inline): the state layer is a circle in the pressed square (web), outlined ripple corner (nit), and style.borderRadius ignored without docs.
Tested on web and Android.
- give the touchable and the disabled layer the container corner less the outline, morphing with it - make the web ripple container inherit the touchable's corner so a held press fills the whole container - document that `borderRadius` in `style` is ignored - stop `TextInput.Icon` accepting an `iconSize` it ignores Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
#5218 is in
|
`filled` and `tonal` are now IconButton modes too, so the map is gone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
Two small things for
|
Set `aria-busy` on the button, always as a boolean so TalkBack stops saying "busy" once loading ends, and hide the indicator from assistive technology. Document that `loading` doesn't disable the button. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
A hidden ActivityIndicator stays an accessible view, and on Android an accessible view is a keyboard stop. A loading IconButton had a second, invisible Tab stop on its indicator. ActivityIndicator now drops `accessible` when it gets `aria-hidden`.
The migration guide's code comments and the `mode` JSDoc used em dashes; they now use colons.
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.





Motivation
Brings IconButton in line with Material 3 Expressive: five sizes, narrow/default/wide widths, round/square shapes that morph on press and toggle, filled/tonal/outlined/standard colors, and a 0.10 disabled opacity.
Related issue
https://app.notion.com/p/callstack/Modernize-IconButton-to-Material-3-Expressive-3ac5d027c0f880fcb083e5a909d4d82b
Test plan
Checked the example app on web, iOS and Android.
Screenshots / Videos
BREAKING CHANGE: IconButton's
sizeis now a named size (extra-smalltoextra-large, withiconSizefor the glyph), thecontainedandcontained-tonalmodes are renamedfilledandtonal, andAppbar.ActionandAppbar.BackActionno longer take a numericsize.