feat: migrate ButtonFilter component to MMDS#964
Merged
Conversation
Contributor
📖 Storybook Preview |
Contributor
📖 Storybook Preview |
7b1414c to
5024a8a
Compare
Contributor
📖 Storybook Preview |
georgewrmarshall
commented
Mar 9, 2026
Contributor
📖 Storybook Preview |
1eb0ff1 to
05d5cd0
Compare
Contributor
📖 Storybook Preview |
georgewrmarshall
commented
Mar 9, 2026
Contributor
📖 Storybook Preview |
Contributor
📖 Storybook Preview |
georgewrmarshall
commented
Mar 9, 2026
| const [activeFilter, setActiveFilter] = useState<FilterOption>('All'); | ||
|
|
||
| return ( | ||
| <Box flexDirection={BoxFlexDirection.Column} gap={4}> |
Contributor
Author
There was a problem hiding this comment.
Story to show a production like layout
georgewrmarshall
commented
Mar 9, 2026
Comment on lines
183
to
195
| {typeof children === 'string' ? ( | ||
| <TextOrChildren | ||
| textProps={{ | ||
| variant: TextVariant.BodyMd, | ||
| fontWeight: FontWeight.Medium, | ||
| color: TextColor.TextDefault, | ||
| twClassName: `shrink grow-0 flex-wrap text-center ${isLoading ? 'opacity-0' : ''} ${textClassName ? textClassName(pressed) : ''}`, | ||
| ...textProps, | ||
| }} | ||
| <Text | ||
| variant={TextVariant.BodyMd} | ||
| fontWeight={FontWeight.Medium} | ||
| color={TextColor.TextDefault} | ||
| {...textProps} | ||
| twClassName={`shrink grow-0 flex-wrap text-center ${isLoading ? 'opacity-0' : ''} ${textClassName ? textClassName(pressed) : ''} ${textProps?.twClassName ?? ''}`} | ||
| > | ||
| {children} | ||
| </TextOrChildren> | ||
| </Text> | ||
| ) : ( | ||
| <View style={tw.style(isLoading && 'opacity-0')}>{children}</View> | ||
| )} |
Contributor
Author
There was a problem hiding this comment.
Because we need to wrap the children in a view that is linked to isLoading, TextOrChildren is redundant here and adds bloat
…r/ButtonFilter.stories.tsx
Contributor
📖 Storybook Preview |
brianacnguyen
approved these changes
Mar 9, 2026
georgewrmarshall
added a commit
that referenced
this pull request
Mar 10, 2026
## Release 25.0.0 This release includes new components migrated from Extension and Mobile, breaking API improvements to ButtonIcon and Input components, and continued ADR-0003/0004 type migrations. ### 📦 Package Versions - `@metamask/design-system-shared`: **0.4.0** - `@metamask/design-system-react`: **0.11.0** - `@metamask/design-system-react-native`: **0.11.0** ### 🔄 Shared Type Updates (0.4.0) #### Component Type Additions (#964, #955) Added shared types for newly migrated components following ADR-0003 and ADR-0004 patterns: **What Changed:** - Added `ButtonFilter` shared types with `ButtonFilterVariant` const object and `ButtonFilterPropsShared` - Added `BannerBase` shared types with `BannerBaseSeverity` const object and `BannerBasePropsShared` **Impact:** - Enables consistent ButtonFilter and BannerBase implementations across React and React Native - Continues ADR-0003/0004 const-object + string-union pattern adoption ### 🌐 React Web Updates (0.11.0) #### Added - Added `ButtonFilter` component for filter button functionality (#964) - Added `BannerBase` component for creating custom banner notifications (#961) #### Changed - **BREAKING:** Updated `ButtonIcon` API to use `variant` prop instead of `isInverse` and `isFloating` boolean props (#948) - Updated `Ai` icon to filled version for visual consistency (#970) ### 📱 React Native Updates (0.11.0) #### Added - Added `ButtonFilter` component (#964) - Added `BottomSheet` component for modal interactions (#963) - Added `MainActionButton` component for primary CTAs (#952) - Added `BannerBase` component for custom banners (#955) - Added `ListItem` component for standardized list rows (#958) - Added `TabEmptyState` component for empty states (#949) - Added `BottomSheetDialog` component for dialogs (#905) #### Changed - **BREAKING:** Updated `ButtonIcon` API to use `variant` prop instead of `isInverse` and `isFloating` boolean props (#948) - **BREAKING:** `Input` component now requires `value` prop and is controlled-only (#960) - Updated `Ai` icon to filled version (#970) #### Fixed - Fixed iOS placeholder alignment issue in `Input` component (#960) - Fixed missing component exports (#967) ###⚠️ Breaking Changes #### ButtonIcon Variant Prop (Both Platforms) **What Changed:** - Removed `isInverse` and `isFloating` boolean props - Added `variant` prop with three options: - `ButtonIconVariant.Default` (transparent background - default) - `ButtonIconVariant.Filled` (muted background with rounded corners - new) - `ButtonIconVariant.Floating` (colored background with inverse icon - replaces `isFloating`) **Migration:** ```tsx // Before <ButtonIcon name={IconName.Add} isFloating /> // After <ButtonIcon name={IconName.Add} variant={ButtonIconVariant.Floating} /> ``` See migration guides for complete instructions: - [React Migration Guide](./packages/design-system-react/MIGRATION.md#from-version-0100-to-0110) - [React Native Migration Guide](./packages/design-system-react-native/MIGRATION.md#from-version-0100-to-0110) #### Input Controlled-Only (React Native Only) **What Changed:** - Removed `defaultValue` prop - `value` prop is now required - All Input instances must be controlled with state management **Migration:** ```tsx // Before <Input placeholder="Enter text" defaultValue="Initial" onChange={handleChange} /> // After const [text, setText] = useState('Initial'); <Input placeholder="Enter text" value={text} onChange={setText} /> ``` **Impact:** - Affects `Input` and `TextField` components - Provides consistent behavior and fixes iOS placeholder alignment See [React Native Migration Guide](./packages/design-system-react-native/MIGRATION.md#from-version-0100-to-0110) for complete instructions. ### ✅ Checklist - [x] Changelogs updated with human-readable descriptions - [x] Changelog validation passed (`yarn changelog:validate`) - [x] Version bumps follow semantic versioning - design-system-shared: minor (0.3.0 → 0.4.0) - new shared types - design-system-react: minor (0.10.0 → 0.11.0) - new components + breaking ButtonIcon change - design-system-react-native: minor (0.10.0 → 0.11.0) - new components + breaking ButtonIcon and Input changes - [x] Breaking changes documented with migration guidance - [x] Migration guides updated with before/after examples - [x] PR references included in changelog entries <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Although this PR is mostly versioning/docs, it formalizes breaking public API changes (`ButtonIcon` and RN `Input`) that will require downstream updates and could cause consumer build failures if missed. > > **Overview** > Bumps the monorepo release to `25.0.0` and publishes new package versions (`@metamask/design-system-react@0.11.0`, `@metamask/design-system-react-native@0.11.0`, `@metamask/design-system-shared@0.4.0`) with updated changelogs. > > Documents newly added components/types (`ButtonFilter`, `BannerBase`, plus several React Native-only additions like `BottomSheet`, `ListItem`, etc.) and **breaking API changes**: `ButtonIcon` replaces `isInverse`/`isFloating` with a `variant` prop (React + RN), and React Native `Input` becomes controlled-only (requires `value`, removes `defaultValue`). Migration guides are updated with before/after examples and new compare links. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 0148a27. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Migrates the
ButtonFiltercomponent from MetaMask Mobile into MMDS across@metamask/design-system-react-nativeand@metamask/design-system-react. The migration includes shared props in@metamask/design-system-shared, component implementations, stories, tests, and package exports.The implementation preserves mobile behavior (
isActivevisual state with ButtonBase wrapping) while aligning with MMDS architecture rules (ADR-0003/0004 style layering and shared type ownership).Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-294
Related: https://consensyssoftware.atlassian.net/browse/DSYS-272
Manual testing steps
git checkout button-filter && yarn installyarn buildyarn lintyarn testyarn workspace @metamask/design-system-react jest --verbose ButtonFilter.test.tsx --coverage --collectCoverageFrom='src/components/ButtonFilter/**/*.{ts,tsx}' --runInBand --watchman=falseyarn workspace @metamask/design-system-react-native jest --verbose ButtonFilter.test.tsx --coverage --collectCoverageFrom='src/components/ButtonFilter/ButtonFilter.tsx' --runInBand --watchman=falseButtonFilterstories render in both web and native storybooks.Screenshots/Recordings
N/A (component migration with tests and stories updated).
Before
N/A
After
buttonfilter.mov
buttonfilter.docs.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Adds a new cross-platform
ButtonFilterand shared types, plus a small change toButtonBasetext rendering that could impact styling/props for any button with string children.Overview
Introduces a new
ButtonFiltercomponent in both@metamask/design-system-reactand@metamask/design-system-react-native, exposing anisActivestate that toggles background/text styles while delegating behavior toButtonBase.Adds shared
ButtonFilterPropsSharedto@metamask/design-system-shared, wires up package exports, and includes Storybook stories/docs plus unit tests for active/inactive, disabled, and interaction behavior.Updates React Native
ButtonBaseto render string children withText(instead ofTextOrChildren) and explicitly mergestextProps.twClassNameinto the computedtwClassName.Written by Cursor Bugbot for commit 20026ba. This will update automatically on new commits. Configure here.