Skip to main content
cngx-src documentation

provideTextScale

Functioncore/themingv0.1.0

projects/core/theming/text-scale.ts

Description#

Install the text-scale preference at app root and reflect it onto <html data-text-size>, mirroring how density is applied by attribute. The reflector is an effect (not afterNextRender) so it re-runs on every runtime injectTextScale().set(...); the DOM write is wrapped in untracked() per the signal-architecture rules.

The default md rung is the identity multiplier, so provideTextScale() with no argument (or an md value) leaves every font-size pixel-identical to today.

bootstrapApplication(AppComponent, {
  providers: [provideTextScale('lg')],
});

Signature#

provideTextScale(initial: CngxTextScaleValue)

Parameters#

@paraminitialCngxTextScaleValue= 'md'

Returns#

EnvironmentProviders