diff --git a/.github/workflows/migration-status.yml b/.github/workflows/migration-status.yml index 9b74e5e6f78..d2cf2599c1f 100644 --- a/.github/workflows/migration-status.yml +++ b/.github/workflows/migration-status.yml @@ -5,6 +5,19 @@ on: workflow_dispatch: jobs: + merge-props: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 + with: + node-version-file: '.nvmrc' + cache: 'npm' + - name: install dependencies + run: npm ci + - name: run migration script + run: node script/merge-props-migration-status.mts >> $GITHUB_STEP_SUMMARY + react-compiler: runs-on: ubuntu-latest steps: diff --git a/contributor-docs/adrs/adr-025-prop-merging.md b/contributor-docs/adrs/adr-025-prop-merging.md new file mode 100644 index 00000000000..497888f448d --- /dev/null +++ b/contributor-docs/adrs/adr-025-prop-merging.md @@ -0,0 +1,133 @@ +# Prop merging conventions + +📆 Date: 2026-07-28 + +## Status + +| Stage | State | +| -------------- | ----------- | +| Status | Proposed ⚠️ | +| Implementation | Pending ⚠️ | + +## Context + +Primer components often set props on an element while also accepting those same +props from consumers. Relying on object spread order alone either replaces +component behavior and styling or prevents consumers from customizing supported +props. Inconsistent precedence also makes component APIs difficult to predict. + +We need one convention for combining component-authored and consumer-authored +props, plus an implementation that applies it consistently. + +## Decision + +Components must intentionally merge any prop that both the component and +consumer can provide. Pass component props first and consumer props second to the +`mergeProps` utility: + +```tsx +