Skip to content

feat: [DSRN ]Added TitleStandard#1051

Draft
brianacnguyen wants to merge 4 commits intomainfrom
dsrn/titlestandard
Draft

feat: [DSRN ]Added TitleStandard#1051
brianacnguyen wants to merge 4 commits intomainfrom
dsrn/titlestandard

Conversation

@brianacnguyen
Copy link
Copy Markdown
Contributor

@brianacnguyen brianacnguyen commented Apr 8, 2026

Description

Adds TitleStandard to @metamask/design-system-react-native: a left-aligned title block with optional top row (topAccessory), inline title accessory (titleAccessory), and a bottom row that is either bottomLabel (with default secondary typography when it’s a string) or bottomAccessory when there is no renderable bottomLabel.

Shared layout props live in TitleStandardPropsShared in @metamask/design-system-shared (ADR-0004 alignment with other shared types). The RN implementation uses BoxHorizontal / TextOrChildren patterns, titleProps / bottomLabelProps for platform Text, and twClassName + View props on the root.

Also includes unit tests, a README, Storybook stories (and registration in storybook.requires.js), and a MIGRATION.md section for 0.14.0 → 0.15.0 documenting the stable API: title is required, topLabel / topLabelProps removed in favor of topAccessory, and bottom row behavior when both bottomLabel and bottomAccessory are passed.

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-582

Manual testing steps

  1. From the repo root, run React Native Storybook (yarn storybook:ios or yarn storybook:android per your setup).
  2. Open Components → TitleStandard and confirm Default, Title, TitleAccessory, TopAccessory, BottomLabel, and BottomAccessory match expected layout and copy.
  3. Run package tests: yarn workspace @metamask/design-system-react-native run jest -- TitleStandard (or your usual Jest invocation for that workspace).

Screenshots/Recordings

If applicable, add screenshots and/or recordings to visualize the before and after of your change.

Before

N/A — new component.

After

Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2026-04-07.at.19.08.06.mov

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
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

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.

Note

Low Risk
Low risk: changes are additive (new component, shared type, docs, stories, tests) with no modifications to existing runtime flows beyond new exports.

Overview
Adds new TitleStandard component to @metamask/design-system-react-native, providing a left-aligned title block with optional topAccessory, inline titleAccessory, and a mutually exclusive bottom row (bottomLabel takes priority over bottomAccessory).

Exposes the component and new shared contract TitleStandardPropsShared via @metamask/design-system-shared, and wires up Storybook, unit tests, and component README. Updates MIGRATION.md with guidance for the stable 0.15.0+ API (required title, topLabel removal, and bottom-row behavior).

Reviewed by Cursor Bugbot for commit ec63d5b. Bugbot is set up for automated code reviews on this repo. Configure here.

@brianacnguyen brianacnguyen self-assigned this Apr 8, 2026
@brianacnguyen brianacnguyen requested a review from a team as a code owner April 8, 2026 02:11
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

📖 Storybook Preview

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

📖 Storybook Preview

@brianacnguyen brianacnguyen marked this pull request as draft April 8, 2026 06:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

📖 Storybook Preview

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

📖 Storybook Preview

title="$4.42"
titleEndAccessory={
<Box twClassName="ml-2">
<Icon name={IconName.Info} size={IconSize.Sm} />
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.

Suggested change
<Icon name={IconName.Info} size={IconSize.Sm} />
<Icon name={IconName.Info} size={IconSize.Md} />

sm looks a bit small, recommending md

Image

gap={1}
>
<Icon name={IconName.Mobile} size={IconSize.Sm} />
<Text variant={TextVariant.BodySm}>Import from mobile</Text>
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.

Hm, it looks like when the color is not specified, topAccessory defaults to text-default.

Would it be possible to add test to catch this?

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.

Similarly, fontweight needs to be specified, otherwise it defaults to regular.

If other devs use this right out of the box, they might not know, so wondering if we can update the defaults to match.

Image

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.

Since the design did not include a topLabel, I just put a topAccessory there so people can place ANYTHING in

Copy link
Copy Markdown
Contributor

@amandaye0h amandaye0h left a comment

Choose a reason for hiding this comment

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

Added 2 comments

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants