Skip to content

feat(dsr): add SectionDivider React parity (DSYS-750) - #1441

Draft
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/react-parity-from-mobile-6076
Draft

feat(dsr): add SectionDivider React parity (DSYS-750)#1441
cursor[bot] wants to merge 5 commits into
mainfrom
cursor/react-parity-from-mobile-6076

Conversation

@cursor

@cursor cursor Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Adds React (@metamask/design-system-react) SectionDivider parity for epic DSYS-302 / DSYS-750, matching the existing React Native MMDS horizontal-rule API.

Queue note: Content (DSYS-1043, PR #1436), ListItem (DSYS-713, PR #1439), and SectionHeader (DSYS-751, PR #1440) already have open draft PRs, so this run took the next priority-queue item (SectionDivider). Jira MCP could not be authenticated in this cloud environment (interactive OAuth unavailable), so the ticket was not auto-assigned/transitioned — please claim DSYS-750 manually if still To Do.

Implementation mirrors RN: Box with top-only border-t* mapping from borderWidth, default BoxBorderColor.BorderMuted, marginVertical={5}, and self-stretch. No shared types (same as RN — props are BoxProps). No React BoxRow / BoxColumn / TextOrChildren.

Audit comparison (Phase 1)

Concern Extension / web API Mobile / RN (MMDS) API Decision
Component name / location No MMDS SectionDivider in component-library. Nearest ad-hoc: ConfirmInfoRowDivider (inline styles), settings Divider (DSR Box + h-px bg), snaps divider factory MMDS SectionDivider = BoxProps with top-only border defaults Keep MMDS SectionDivider name in DSR
Prop names Local dividers are prop-less or className-only Full Box props (borderWidth, borderColor, marginVertical, …) Unified to RN API
Types / variants / sizes N/A (hardcoded 1px muted lines) BoxBorderWidth / BoxBorderColor / BoxSpacing via Box Match RN defaults + override surface
Border model Often height: 1px + background color Top-only border-t hairline on zero-height box Match RN (not Extension bg-bar pattern)
Event handlers N/A N/A N/A
Styling className / inline style twClassName / style Platform layer only (className on React)

Answers

  • Shared vs platform: No dedicated shared SectionDividerPropsShared (RN also uses BoxProps only). Platform: className/style (web) vs twClassName/style (RN).
  • Naming conflicts: None (disabled/isDisabled N/A).
  • Strategy: Unified for the new React API (align to RN). Extension ad-hoc dividers remain Phase 2 consumer migrations.
  • Mapping: React parity belongs under SectionDivider in DSR. Extension analogues are differently shaped local helpers, not the MMDS API.

Known gaps (Phase 2)

  • Extension ConfirmInfoRowDivider, settings Divider, and snaps divider still use local one-off implementations; migrate consumers to DSR SectionDivider separately when product wants shared spacing/border defaults.

Related issues

Fixes: DSYS-750 (parent epic DSYS-302)

Manual testing steps

  1. From repo root: yarn build && yarn workspace @metamask/design-system-react run test --testPathPattern='components/SectionDivider/SectionDivider\.test'
  2. yarn storybook → open React Components / SectionDivider
  3. Verify Default (Above/Below), BorderWidth, BorderColor, and MarginVertical stories in light + dark
  4. Confirm className overrides (e.g. self-center) via Controls / Docs

Screenshots/Recordings

Before

N/A — new React component

After

SectionDivider Default story (light + dark)

SectionDivider BorderWidth story

SectionDivider BorderColor story

SectionDivider MarginVertical story

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs
  • I've completed the PR template to the best of my ability
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

To show artifacts inline, enable in settings.

Open in Web View Automation 

cursoragent and others added 2 commits August 10, 2026 16:03
Implement design-system-react SectionDivider matching the RN Box-based
API: top-only border hairline, BorderMuted, marginVertical 5, self-stretch.

Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

📖 Storybook Links

Compare the preview for this pull request with the latest Storybooks from the main branch.

🔀 Pull Request Preview

🌳 Main Branch (Latest)

@github-actions

Copy link
Copy Markdown
Contributor

📖 Storybook Links

Compare the preview for this pull request with the latest Storybooks from the main branch.

🔀 Pull Request Preview

🌳 Main Branch (Latest)

Comment on lines +30 to +37
<Box
ref={ref}
borderColor={borderColor ?? BoxBorderColor.BorderMuted}
marginVertical={marginVertical ?? 5}
className={twMerge('self-stretch', borderTopClass, className)}
style={style}
{...rest}
/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@cursoragent make sure this is an


element for correct semantic html

@cursor cursor Bot Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • Updated SectionDivider to render a semantic <hr /> via Box’s asChild, preserving existing API and styling. Added border-0 to ensure only the top border is visible.
  • Adjusted ref typing/forwarding and updated the unit test to expect HTMLHRElement.
  • Refreshed README to note <hr /> semantics.

Key edits:

  • packages/design-system-react/src/components/SectionDivider/SectionDivider.tsx
  • packages/design-system-react/src/components/SectionDivider/SectionDivider.test.tsx
  • packages/design-system-react/src/components/SectionDivider/README.mdx
Open in Web Open in Cursor 

Comment on lines +10 to +13
### Added

- Added `SectionDivider` React parity with the React Native MMDS horizontal rule API ([#1441](https://github.com/MetaMask/metamask-design-system/pull/1441))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove the changelog update that is only for the review process @cursoragent

cursoragent and others added 3 commits August 11, 2026 19:46
Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants