Skip to content

Conversation

@anjju
Copy link
Contributor

@anjju anjju commented Aug 1, 2025

Closes #4520

Changelog

Changed


How to style an element
Outside of very conscious exceptions, style all your fonts with the Carbon helpers so you can easily
keep your code robust and consistent. Avoid using single CSS attributes like font-weight or font-size
whenever possible and rather defer the type handling to Carbon.

.selector {
 // Include a type style
 @include type.style('productive-heading-01');
}

@alina-jacob
Copy link
Member

Thanks for the PR, looking good! @anjju

Just noting a couple of things,

  • I'd update the heading from "How to style an element" to "Type-styles"
  • I'd change the heading "How to style an element" from H2 to H3
  • I'd also rephrase the paragraph to "Unless there are specific exceptions, always use Carbon helpers to style your fonts. This ensures your code stays consistent and maintainable. Avoid directly setting individual CSS properties like font-weight or font-size; instead, rely on Carbon to handle all typography styling."

@thyhmdo, @laurenmrice, feel free to add any other recommendations!

Copy link
Member

@tay1orjones tay1orjones left a comment

Choose a reason for hiding this comment

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

I agree w/ Alina's suggestions. Otherwise this LGTM, thanks!

@thyhmdo
Copy link
Collaborator

thyhmdo commented Oct 6, 2025

Yeah @anjju , also agree with @alina-jacob's feedback above

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.

[Docs]: The doc for applying a type style is hidden from the visible viewport

6 participants