Repository navigation
Description
Thread here https://expensify.slack.com/archives/C08CZDJFJ77/p1772185682696469
Problem
The Button component currently has 53 props, mixing concerns across three domains:
- Text configuration (5 props):
text,textStyles,textHoverStyles,primaryTextNumberOfLines,secondLineText - Icon configuration (8 props):
icon,iconRight,iconFill,iconHoverFill,iconStyles,iconRightStyles,iconWrapperStyles,shouldShowRightIcon - Button behavior/styling (35+ props): sizes, variants, events, layout, keyboard, state
This makes it difficult to extend. For example, in the Domain Control project, we need to place a DotIndicator next to the button text in ButtonWithDropdownMenu for RBR. The dot must appear on the left side of the text, requiring two icons with different fill styles — impossible today without adding yet more props.
Proposal
Apply the Compound Component pattern (composition over configuration). Extract text and icon responsibilities into sub-components:
// New interface
<Button onPress={handlePress} success>
<Button.Icon src={Expensicons.Plus} />
<Button.Text>Create expense</Button.Text>
<Button.Icon src={Expensicons.DownArrow} />
</Button>
// With DotIndicator (the motivating use case)
<Button onPress={handlePress} success>
<Button.Icon src={Expensicons.DotIndicator} fill={theme.danger} />
<Button.Text>Submit</Button.Text>
<Button.Icon src={Expensicons.DownArrow} />
</Button>Button keeps its own props (styling, events, state, accessibility) but delegates content layout to children.
Benefits
- Extensibility without prop explosion — new content arrangements (multiple icons, indicators, badges) require zero new Button props
- Fewer unnecessary re-renders — individual sub-components can be memoized independently; today, any prop change triggers a full Button re-render
- Clearer API — the JSX tree visually communicates what the button contains
- Easier code review — changes to icon or text behavior are scoped to their sub-component
Migration Strategy
The migration must be incremental to avoid regressions across the ~45 files (72 instances) that use Button today:
- Phase 1 — Build the compound components alongside the existing props API. The old props-based rendering continues to work unchanged. Introduce
Button.Icon,Button.Text(and potentiallyButton.SecondaryText) as sub-components. - Phase 2 — Deprecate old text/icon props. Mark the 13 text/icon props as
@deprecatedin TypeScript. Add an ESLint rule (orno-restricted-syntaxconfig) that warns on the deprecated props to guide contributors toward the new API. - Phase 3 — Incremental file-by-file migration. Each PR migrates a handful of files. This can be distributed across contributors.
- Phase 4 — Remove deprecated props once all usages are migrated.
Scope
src/components/Button/index.tsx— main componentsrc/components/ButtonWithDropdownMenu/index.tsx— primary consumer that motivates this change- ~45 files importing Button, ~72
<Buttoninstances across the codebase - [NoQA] Button - <LinkButton/> component implementation #91824 (comment)
Issue Owner
Current Issue Owner: @mallenexpensifyIssue Owner
Current Issue Owner: @mallenexpensifyMetadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
war-in commentedon Mar 2, 2026
Hi! Draft PR is prepared and being reviewed by @dariusz-biela and @adhorodyski, thank you both!
I'm currently involved in
React Native upgradeandDomain controlprojects, so I handed this task to @Guccio163, who'll take care of it. That way, we won't block it on me and we can iterate fastermelvin-bot commentedon Mar 6, 2026
@ZhenjaHorbach Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
165 remaining items
MelvinBot commentedon Aug 18, 2026
Created the sub-issue for #98861 and linked it under this tracking issue:
#98878 — Button migration batch 10: leftover files after census re-scan + BaseWidgetItem public API
It follows the existing
Button migration batch Nformat (matching batches 1–9), captures the PR's scope (44 leftover files from the census re-scan,BaseWidgetItem'sbuttonPropspublic API + its 14 callers, and theButtonIconaccessibilityLabeladdition), and is attached as a native sub-issue of this one. Assigned toGuccio163andZhenjaHorbach.Let me know if you'd like the title, scope notes, or assignees adjusted.
ZhenjaHorbach commentedon Aug 18, 2026
Oh
It works 😁
Nice
mountiny commentedon Aug 18, 2026
Yep sounds good
Guccio163 commentedon Aug 20, 2026
@MelvinBot create a new sub-issue, for migrating success/danger props to variant in Button wrappers + other button-specific props passed by wrappers that has changes in Button component.
MelvinBot commentedon Aug 20, 2026
Created the sub-issue and linked it as a native sub-issue under this tracker:
#99057 — Button wrappers: align legacy button-specific props (
success/danger→variant) inConfirmModal&FormAlertWithSubmitButtonThis covers the "fuller alignment" the plan flagged as a separate decision — renaming a wrapper's own public props to the composed conventions. I scoped it to the wrappers that aren't already handled:
ConfirmModal→ConfirmContent— both expose publicsuccess/dangerbooleans andConfirmContentstill renders the old@components/Button. Collapse to a singlevariantprop + migrate the internal Button. (~16 caller files passsuccess/danger.)FormAlertWithSubmitButton— still on the old Button; forwards the same concepts underisSubmitActionDangerous→danger,useSmallerSubmitButtonSize→medium/large,shouldBlendOpacity, and hardcodessuccess. Migrate the internal Button to composed conventions (variant/size/blendOpacity). (~45 caller files.)Deliberately excluded (already covered):
ButtonWithDropdownMenupublic API → done in [Due for payment 2026-07-23] ButtonWithDropdownMenu — align public API to composed conventions #95179.BaseWidgetItem(buttonProps→buttonVariant) → [Due for payment 2026-08-29] Button migration batch 10: leftover files after census re-scan + BaseWidgetItem public API #98878 / PR Migrate Button ro ButtonComposed (batch 10) #98861.SettlementButton,AnimatedSettlementButton,AnimatedSubmitButton,FloatingGPSButtonalready use the composed API;AddToWalletButtonwraps the native wallet button, not ourButton.Labeled
Weekly+Taskand assigned toGuccio163,ZhenjaHorbach, andmountinyto match the sibling sub-issues. Let me know if you'd like the scope adjusted (e.g. keepingFormAlertWithSubmitButton's domain-named public props vs. renaming them).view run
ZhenjaHorbach commentedon Aug 31, 2026
The last PR is left!
melvin-bot commentedon Sep 23, 2026
This issue has not been updated in over 15 days. @mountiny, @war-in, @ZhenjaHorbach, @Guccio163 eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
expensify-chore-bot commentedon Nov 19, 2026
@mountiny, @war-in, @ZhenjaHorbach, @Guccio163, this Monthly task hasn't been acted upon in 6 weeks; closing.
If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.