Skip to content

[WIP] feat: add component config in ThemeProvider#365

Draft
stacysun-cb wants to merge 6 commits intomasterfrom
stacy/add-component-config
Draft

[WIP] feat: add component config in ThemeProvider#365
stacysun-cb wants to merge 6 commits intomasterfrom
stacy/add-component-config

Conversation

@stacysun-cb
Copy link
Contributor

What changed? Why?

Root cause (required for bugfixes)

UI changes

iOS Old iOS New
old screenshot new screenshot
Android Old Android New
old screenshot new screenshot
Web Old Web New
old screenshot new screenshot

Testing

How has it been tested?

  • Unit tests
  • Interaction tests
  • Pseudo State tests
  • Manual - Web
  • Manual - Android (Emulator / Device)
  • Manual - iOS (Emulator / Device)

Testing instructions

Illustrations/Icons Checklist

Required if this PR changes files under packages/illustrations/** or packages/icons/**

  • verified visreg changes with Terran (include link to visreg run/approval)
  • all illustration/icons names have been reviewed by Dom and/or Terran

Change management

type=routine
risk=low
impact=sev5

automerge=false

@cb-heimdall
Copy link
Collaborator

cb-heimdall commented Feb 3, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 1
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1
CODEOWNERS 🟡 See below

🟡 CODEOWNERS

Code Owner Status Calculation
ui-systems-eng-team 🟡 0/1
Denominator calculation
Additional CODEOWNERS Requirement
Show calculation
Sum 0
0
From CODEOWNERS 1
Sum 1

{
forwardRef(function Button(_props: ButtonProps, ref: React.ForwardedRef<View>) {
const theme = useTheme();
const mergedProps = mergeComponentProps(
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 maybe we could consider creating a higher order component to encapsulate and reuse prop merging across all our components

background,
color,
borderColor,
borderWidth = 100,
Copy link
Contributor

Choose a reason for hiding this comment

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

default values like this should probably be encapsulated in our "default" component-level theme right? I know we're not going for 100% coverage when we launch this feature, but this is the type of thing it is being introduce for, right?

};

export type ComponentTheme = {
Button: Partial<ButtonBaseProps>;
Copy link
Contributor

Choose a reason for hiding this comment

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

we will want to be more strict than ever around what goes into base props vs full props. Maybe time for us to holistically examine that pattern together

shadowRadius?: ViewStyle['shadowRadius'];
};

export type ComponentTheme = {
Copy link
Contributor

Choose a reason for hiding this comment

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

alternative to consider:

Button: Pick<StyleProps, "borderRadius" | "padding" | "paddingHorizontal" | etc.> & {
  className?: string;
   style?: CSSProperties;
}

// this limits customers to only overriding style opinions, keeping the theme oriented around the theme

const customTheme = {
  // ...
  Button: {
    borderRadius: 900 // can only use theme tokens
  }
}

// prevents abuse from using theme to control behavior
  // ...
  Button: {
    onClick: () = {}   // shouldn't support this
    variant: "negative" // doesn't make sense to set this globally
  }

Copy link
Contributor

Choose a reason for hiding this comment

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

ButtonBaseProps <> StyleProps

Copy link
Contributor

Choose a reason for hiding this comment

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

  • stronger semantics
  • easier to add more harder to take away

Copy link
Contributor

Choose a reason for hiding this comment

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

"variants" can't be themed e.g. Button "negative" can't be configured

Copy link
Contributor

Choose a reason for hiding this comment

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

are some "variant" props an anti-pattern? Do they leak coinbase design patterns to open source i.e we are potentially over opinionated than we need to be and customers can achieve patterns/variants by settings props

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants