Skip to content

Conversation

Zuzze
Copy link
Contributor

@Zuzze Zuzze commented Jul 24, 2025

Summary

To streamline text usage on instance level, Text, Label and Heading support now the following optional props (No breaking changes):

  • variant: if not given, uses old default style as before
  • maxLines: default off like before

New shorthand syntax looks like

  • <Text>Lorem ipsum dolor sit est</Text> -> defaults to <Text size="medium" bold={false}>
  • <Heading>Welcome</Heading> -> defaults to<Heading size="medium" bold={true}>
  • <Label>Name</Label> -> defaults to<Label size="medium">
  • <Code>const var = 1</Code> -> defaults to \<Code size="medium">

New props for Heading, Text, Code, Label:

  • bold: If text is emphasized, will be true. Design team will align so that Figma variants will only have 2 font weights for each. Label has only one font weight in the props API but if inside form where orientation="horizontal" lighter weight will be applied.
  • size: small, medium, large will be used. Label and Code have only 2 sizes. More sizes may be added in future

Under the hood the component also handles:

  • Semantic HTML tag (e.g. code for code, small for small text and p for bigger text and levels for headings
  • mapping to corresponding design system tokens in css modules

Underlying HTML token can still be changed by react-aria props' elementType in Text and level in Heading like before.

Screenshots (if appropriate):

Text

Screenshot 2025-07-30 at 11 08 19 Screenshot 2025-07-30 at 11 08 30

Heading

Screenshot 2025-07-30 at 11 27 23 Screenshot 2025-07-30 at 11 27 29

Label

image

Code

Screenshot 2025-07-30 at 09 40 40

Housekeeping

  • Added links to new Text and Heading, Code, Label from Typography tokens
  • Added storybook config that displays types inside union instead of union in prop table

Dark mode

All text components were also tetsted in dark mode.

image

Testing approaches

New stories will be detected in future by Chromatic

@Zuzze Zuzze requested review from a team as code owners July 24, 2025 20:56
Copy link

changeset-bot bot commented Jul 24, 2025

🦋 Changeset detected

Latest commit: 3aa8f53

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@launchpad-ui/components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Jul 24, 2025

yarn add https://pkg.pr.new/@launchpad-ui/[email protected]
yarn add https://pkg.pr.new/@launchpad-ui/[email protected]
yarn add https://pkg.pr.new/@launchpad-ui/[email protected]

commit: 3aa8f53

Copy link
Contributor

github-actions bot commented Jul 24, 2025

Size Change: +2.42 kB (+0.46%)

Total Size: 530 kB

Filename Size Change
packages/components/dist/index.es.js 19 kB +1.07 kB (+5.94%) 🔍
packages/components/dist/index.js 19.9 kB +1.09 kB (+5.79%) 🔍
packages/components/dist/style.css 8.36 kB +260 B (+3.21%)
ℹ️ View Unchanged
Filename Size
apps/vscode/dist/client.js 111 kB
apps/vscode/dist/server.js 261 kB
packages/box/dist/index.es.js 7.26 kB
packages/box/dist/index.js 7.82 kB
packages/box/dist/style.css 2.67 kB
packages/button/dist/index.es.js 1.89 kB
packages/button/dist/index.js 2.32 kB
packages/button/dist/style.css 3 kB
packages/core/dist/index.es.js 512 B
packages/core/dist/index.js 1.27 kB
packages/drawer/dist/index.es.js 1.76 kB
packages/drawer/dist/index.js 2.22 kB
packages/drawer/dist/style.css 497 B
packages/dropdown/dist/index.es.js 1.15 kB
packages/dropdown/dist/index.js 1.59 kB
packages/filter/dist/index.es.js 2.23 kB
packages/filter/dist/index.js 2.68 kB
packages/filter/dist/style.css 881 B
packages/focus-trap/dist/index.es.js 418 B
packages/focus-trap/dist/index.js 852 B
packages/form/dist/index.es.js 4.25 kB
packages/form/dist/index.js 4.73 kB
packages/form/dist/style.css 2.21 kB
packages/icons/dist/index.es.js 1.3 kB
packages/icons/dist/index.js 1.73 kB
packages/icons/dist/style.css 532 B
packages/menu/dist/index.es.js 3.69 kB
packages/menu/dist/index.js 4.16 kB
packages/menu/dist/style.css 872 B
packages/modal/dist/index.es.js 3.08 kB
packages/modal/dist/index.js 3.55 kB
packages/modal/dist/style.css 898 B
packages/navigation/dist/index.es.js 2.75 kB
packages/navigation/dist/index.js 3.21 kB
packages/navigation/dist/style.css 874 B
packages/overlay/dist/index.es.js 1.02 kB
packages/overlay/dist/index.js 1.42 kB
packages/popover/dist/index.es.js 3.01 kB
packages/popover/dist/index.js 3.43 kB
packages/popover/dist/style.css 529 B
packages/portal/dist/index.es.js 420 B
packages/portal/dist/index.js 835 B
packages/table/dist/index.es.js 1.01 kB
packages/table/dist/index.js 1.44 kB
packages/table/dist/style.css 700 B
packages/tokens/dist/fonts.css 183 B
packages/tokens/dist/index.css 1.47 kB
packages/tokens/dist/index.es.js 3.07 kB
packages/tokens/dist/index.js 3.11 kB
packages/tokens/dist/media-queries.css 113 B
packages/tokens/dist/themes.css 2.27 kB
packages/tooltip/dist/index.es.js 598 B
packages/tooltip/dist/index.js 1.02 kB
packages/tooltip/dist/style.css 337 B
packages/vars/dist/index.es.js 2.66 kB
packages/vars/dist/index.js 2.66 kB

compressed-size-action

@Zuzze Zuzze changed the title feat(components): extend Heading and Text components with variant, align, and maxLines feat(components): extend Heading and Text components with variant and maxLines Jul 25, 2025
Copy link
Contributor

@nhironaka nhironaka left a comment

Choose a reason for hiding this comment

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

nice!

Copy link
Contributor

@matthewferry matthewferry left a comment

Choose a reason for hiding this comment

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

This is dope! And thank you for proactively getting this done! Just a couple things:

  1. let's remove labels from being used in the api for <Text/>. we have <Label /> for that and don't want to encourage those styles in regular copy
  2. I find the use of single variant prop a bit awkward. I can be peaceful with us doing it for this pass (I know there are feels about expanding props), but I would prefer the API be explicit for size and weight.

@Zuzze Zuzze requested a review from matthewferry July 30, 2025 10:05
@apucacao
Copy link
Contributor

bold: If text is emphasized

Just curious: would it make sense to use "emphasized" or something similar to make clear the prop semantics vs visual effect?

Copy link
Contributor

@apucacao apucacao left a comment

Choose a reason for hiding this comment

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

Nice work driving this, @Zuzze!

@Zuzze Zuzze changed the title feat(components): extend Heading and Text components with variant and maxLines feat(components): Typography token styles added to Heading, Text, Label, Code components Jul 30, 2025
@Zuzze
Copy link
Contributor Author

Zuzze commented Jul 30, 2025

bold: If text is emphasized

Just curious: would it make sense to use "emphasized" or something similar to make clear the prop semantics vs visual effect?

Could be, bold was just shorter and less prone to typos I guess 😅 But if others also prefer emphasized or have some better word in mind, I'm not against that either!

Copy link
Contributor

@matthewferry matthewferry left a comment

Choose a reason for hiding this comment

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

LGTM!

@nhironaka nhironaka merged commit c7aa09a into main Jul 31, 2025
14 checks passed
@nhironaka nhironaka deleted the zuzze/feat/text-and-heading-variants branch July 31, 2025 15:30
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.

5 participants