Typography
Font size, weight, alignment, decoration, casing and line height, all controlled from the builder.
Font size
| Utility | Generated CSS |
|---|---|
TextXs() |
font-size: 0.75rem |
TextSm() |
font-size: 0.875rem |
TextBase() |
font-size: 1rem |
TextLg() |
font-size: 1.125rem |
TextXl() |
font-size: 1.25rem |
Text2Xl() |
font-size: 1.5rem |
Text3Xl() |
font-size: 1.875rem |
Text(Length.Rem(2.5)) |
font-size: 2.5rem |
Text(new Length("clamp(...)", "fluid")) |
font-size: clamp(...) |
text-xs (0.75rem)
text-sm (0.875rem)
text-base (1rem)
text-lg (1.125rem)
text-xl (1.25rem)
text-2xl (1.5rem)
text-3xl (1.875rem)
<p class="@Css.TextXs()">text-xs</p>
<p class="@Css.Text3Xl()">text-3xl</p>
Custom font size with Length
Text also accepts a Length,
so you can use any value or unit, including fluid clamp() expressions.
Css.Text(Length.Rem(2.5)); // text-2.5rem
Css.Text(Length.Px(18)); // text-18px
Css.Text(new Length("clamp(1rem,2vw,2rem)", "fluid")); // text-fluid
text-2.5rem
text-fluid
<p class="@Css.Text(Length.Rem(2.5))">text-2.5rem</p>
<p class="@Css.Text(FluidText)">text-fluid</p>
Font weight and style
| Utility | Generated CSS |
|---|---|
FontThin() |
font-weight: 100 |
FontExtralight() |
font-weight: 200 |
FontLight() |
font-weight: 300 |
FontNormal() |
font-weight: 400 |
FontMedium() |
font-weight: 500 |
FontSemibold() |
font-weight: 600 |
FontBold() |
font-weight: 700 |
FontExtrabold() |
font-weight: 800 |
FontBlack() |
font-weight: 900 |
Italic() |
font-style: italic |
NotItalic() |
font-style: normal |
Thin weight
Normal weight
Bold weight
Italic
Not italic
<p class="@Css.FontThin()">Thin weight</p>
<p class="@Css.FontBold()">Bold weight</p>
<p class="@Css.Italic()">Italic</p>
Font family
FontSans(),
FontSerif() and
FontMono() apply the built-in stacks.
Sans(...),
Serif(...) and
Mono(...) prepend one or more custom families
to the matching default, and Font(FontFamily)
takes a fully custom stack.
| Utility | Generated CSS |
|---|---|
FontSans() |
font-family: ui-sans-serif, system-ui, … (font-sans) |
FontSerif() |
font-family: ui-serif, Georgia, … (font-serif) |
FontMono() |
font-family: ui-monospace, … (font-mono) |
Font(FontFamily.Sans) |
font-family: <built-in stack> |
Font(new FontFamily("Inter, sans-serif", "brand")) |
font-family: Inter, sans-serif (font-brand) |
Sans("Inter", …) |
prepends families to the sans stack; hashed class |
Serif(…) / Mono(…) |
prepends families to the serif / mono stack |
Css.FontSans(); // font-sans
Css.Font(FontFamily.Serif); // font-serif
Css.Font(new FontFamily("Inter, sans-serif", "brand")); // font-brand
Css.Sans("Inter", "Helvetica Neue"); // font-sans-inter-helvetica-neue-<hash>
font-sans — the default UI stack
font-serif — the default serif stack
font-mono — const answer = 42;
font-brand — a custom stack
<p class="@Css.Font(FontFamily.Sans)">font-sans</p>
<p class="@Css.Font(FontFamily.Serif)">font-serif</p>
<p class="@Css.Font(FontFamily.Mono)">font-mono</p>
<p class="@Css.Font(BrandFont)">font-brand</p>
Auto-derived class names
class attribute is whitespace separated, so a stack
like Inter, ui-sans-serif, system-ui is not a valid
token. When FontFamily.Name is not set, a readable
token is derived from the families and suffixed with a short hash, for example
Sans("Inter") →
font-sans-inter-<hash>. Pass an explicit name
(new FontFamily(stack, "brand")) when you want a
clean, predictable class.
Alignment and decoration
| Utility | Generated CSS |
|---|---|
TextLeft() |
text-align: left |
TextCenter() |
text-align: center |
TextRight() |
text-align: right |
Underline() |
text-decoration-line: underline |
NoUnderline() |
text-decoration-line: none |
LineThrough() |
text-decoration-line: line-through |
Overline() |
text-decoration-line: overline |
Truncate() |
overflow: hidden; text-overflow: ellipsis; white-space: nowrap |
TextEllipsis() |
text-overflow: ellipsis |
TextClip() |
text-overflow: clip |
Left aligned
Center aligned
Right aligned
Underlined and not underlined
<p class="@Css.TextCenter()">Center aligned</p>
<p class="@Css.TextRight()">Right aligned</p>
<p><span class="@Css.Underline()">Underlined</span></p>
Casing and whitespace
| Utility | Generated CSS |
|---|---|
Uppercase() |
text-transform: uppercase |
Lowercase() |
text-transform: lowercase |
Capitalize() |
text-transform: capitalize |
WhitespaceNoWrap() |
white-space: nowrap |
WhitespaceNormal() |
white-space: normal |
WhitespacePre() |
white-space: pre |
WhitespacePreLine() |
white-space: pre-line |
WhitespacePreWrap() |
white-space: pre-wrap |
WhitespaceBreakSpaces() |
white-space: break-spaces |
uppercase text
LOWERCASE TEXT
capitalize each word
this line will not wrap no matter how long it becomes in the container
<p class="@Css.Uppercase()">uppercase text</p>
<p class="@Css.Capitalize()">capitalize each word</p>
<p class="@Css.WhitespaceNoWrap()">will not wrap</p>
Letter spacing
| Utility | Generated CSS |
|---|---|
TrackingTighter() |
letter-spacing: -0.05em |
TrackingTight() |
letter-spacing: -0.025em |
TrackingNormal() |
letter-spacing: 0em |
TrackingWide() |
letter-spacing: 0.025em |
TrackingWider() |
letter-spacing: 0.05em |
TrackingWidest() |
letter-spacing: 0.1em |
Tracking(Length.Em(0.2)) |
letter-spacing: 0.2em |
Line height
Leading(n) uses the spacing scale for
line-height: Leading(6)
is 1.5rem. The named helpers set the common unitless ratios.
| Utility | Generated CSS |
|---|---|
LeadingNone() |
line-height: 1 |
LeadingTight() |
line-height: 1.25 |
LeadingSnug() |
line-height: 1.375 |
LeadingNormal() |
line-height: 1.5 |
LeadingRelaxed() |
line-height: 1.625 |
LeadingLoose() |
line-height: 2 |
Leading(6) |
line-height: 1.5rem |
Css.TextSm().Leading(6);
// class: text-sm leading-6
// CSS: .leading-6 { line-height: 1.5rem }
Text wrapping and overflow
| Utility | Generated CSS |
|---|---|
TextIndent(4) |
text-indent: 1rem |
TextIndent(Length.Rem(2)) |
text-indent: 2rem |
WordBreakNormal() |
word-break: normal |
WordBreakAll() |
word-break: break-all |
WordBreakKeepAll() |
word-break: keep-all |
OverflowWrapNormal() |
overflow-wrap: normal |
OverflowWrapBreakWord() |
overflow-wrap: break-word |
OverflowWrapAnywhere() |
overflow-wrap: anywhere |
HyphensNone() |
hyphens: none |
HyphensManual() |
hyphens: manual |
HyphensAuto() |
hyphens: auto |
List styles
| Utility | Generated CSS |
|---|---|
ListStyleNone() |
list-style-type: none |
ListDisc() |
list-style-type: disc |
ListDecimal() |
list-style-type: decimal |
ListInside() |
list-style-position: inside |
ListOutside() |
list-style-position: outside |