Skip to content

Text Utilities

Utility classes for text color, alignment, decoration, and transform. All utilities support responsive breakpoint prefixes: sm:, md:, lg:, xl:, 2xl:.


Text Color

Semantic text color utilities. Values reference theme color tokens so they adapt to light/dark mode automatically.

Classes

ClassCSS variable
text-defaultvar(--color-text)
text-secondaryvar(--color-text-secondary)
text-tertiaryvar(--color-text-tertiary)
text-inversevar(--color-text-inverse)
text-placeholdervar(--color-text-placeholder)
text-disabledvar(--color-text-disabled)
text-primaryvar(--color-primary)
text-on-primaryvar(--color-on-primary)
text-successvar(--color-success)
text-warningvar(--color-warning)
text-errorvar(--color-error)
text-infovar(--color-info)
text-inheritinherit

.text-default — primary text

.text-secondary — secondary text

.text-tertiary — tertiary text

.text-placeholder — placeholder text

.text-disabled — disabled text

.text-primary — brand primary

.text-success — success

.text-warning — warning

.text-error — error

.text-info — info

Responsive

html
<p class="text-secondary md:text-default">
  Secondary on mobile, default from md up
</p>

SCSS

scss
@use '@grundtone/design-tokens/scss/lib' as gt;

.caption {
  color: gt.color('text-secondary');
}

Text Alignment

Classes

.text-left
.text-center
.text-right
ClassCSS
.text-lefttext-align: left
.text-centertext-align: center
.text-righttext-align: right
.text-justifytext-align: justify

Responsive

Change alignment at different breakpoints using the {breakpoint}: prefix:

Left on mobile, centered from md up — resize your browser to see
html
<!-- Left on mobile, centered from md up -->
<h1 class="text-left md:text-center">Responsive heading</h1>

<!-- Centered on mobile, right-aligned from lg up -->
<p class="text-center lg:text-right">Responsive paragraph</p>
ClassApplies from
.text-centerAll sizes
.sm:text-center≥ 640px
.md:text-center≥ 768px
.lg:text-center≥ 1024px
.xl:text-center≥ 1280px
.2xl:text-center≥ 1536px

The same breakpoint prefixes work for -left, -right, and -justify.

See Breakpoints for the full breakpoint scale and customisation.


Text Decoration

Underline, line-through, and no-underline utility classes.

Classes

ClassCSS
underlinetext-decoration: underline
line-throughtext-decoration: line-through
no-underlinetext-decoration: none

.underline

.line-through

.no-underline

Usage

html
<a href="#" class="no-underline">Link without underline</a>
<span class="line-through">Discounted price</span>

Responsive

html
<span class="no-underline md:underline">
  Underlined from md and up
</span>

Text Transform

Uppercase, lowercase, capitalize, and normal-case utility classes.

Classes

ClassCSS
uppercasetext-transform: uppercase
lowercasetext-transform: lowercase
capitalizetext-transform: capitalize
normal-casetext-transform: none

.uppercase

.lowercase

.capitalize — example text

.normal-case

Responsive

html
<span class="uppercase md:normal-case">
  Uppercase on mobile only
</span>