Directive

wrTypography

One directive covering every text role. It sets no element of its own — put it on the <p>, <h1>, <code> or <ul> you already have, pick a variant, and it applies the shared --wr-text-* / --wr-font-weight-* / --wr-leading-* tokens by binding a class.

Why ngwr provides this

Type is the one system every screen touches, and hand-rolled heading styles drift apart the moment two people write CSS. Routing every text role through one directive means a theme override re-skins the whole app, and the roles stay a closed set instead of a pile of one-off classes.

Selector

Attribute directive — it styles the host element, never replaces it.

ngwr/typography

The directive styles what it sits on

Semantics stay yours — a heading is still an <h1>, a list still a <ul>.

Inputs

The complete surface — five inputs, no outputs, no public methods.

NameDescriptionTypeDefault
variantThe text role. Drives size, weight, leading and — for some variants — colour. code additionally implies mono.WrTypographyVariant'body'
toneColour override. null emits no tone class at all, leaving each variant its own colour — body and headings read --wr-color-on-surface, lead / caption / overline are muted, link is primary. Set a tone only to depart from that.WrTypographyTone | nullnull
alignHorizontal alignment. null emits no class, so the element inherits alignment from its container.WrTypographyAlign | nullnull
truncateClip overflow to one line with an ellipsis. Coerced, so the bare attribute works. Forces display: inline-block on the host.booleanfalse
monoSwitch to --wr-font-family-mono. Coerced, so the bare attribute works. Implied by variant="code".booleanfalse

Variants

WrTypographyVariant in full. Several carry their own colour, which is what tone: null preserves.

NameDescriptionTypeDefault
displayHero headline. The only fluid size.clamp(--wr-text-4xl, 6vw, 3.75rem)
h1 … h6The heading ladder.--wr-text-3xl … --wr-text-base
leadIntro paragraph under a heading.--wr-text-lg · muted
bodyDefault. Running text.--wr-text-base
smallSmall print.--wr-text-sm
captionCaptions, helper text.--wr-text-xs · muted
overlineSection label above a heading.--wr-text-xs · uppercase · muted
codeInline code. Implies mono; sized in em so it tracks its context.tinted inline chip · 0.875em
listApplies to the list element itself; markers and nesting are styled from the element type.ul / ol / dl aware
linkInline link styling.primary

Emitted classes

The directive binds [class] to a single computed string. Useful when you need to target its output from your own stylesheet.

NameDescriptionTypeDefault
wr-typographyBase class. Sets margin, font family, and --wr-color-on-surface.always
wr-typography--{variant}One per variant — always emitted, since variant always resolves.always
wr-typography--tone-{tone}Omitted entirely when tone is null.when `tone` is set
wr-typography--align-{align}Omitted entirely when align is null.when `align` is set
wr-typography--truncateAdds the ellipsis clamp.when `truncate`
wr-typography--monoThe one implicit rule in the directive.when `mono` or `variant="code"`

See also