Skip to main content
cngx-src documentation

provideDensity

Functioncore/themingv0.1.0

projects/core/theming/density.ts

Description#

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

bootstrapApplication(AppComponent, {
  providers: [provideDensity('compact')],
});

Signature#

provideDensity(initial: CngxDensityValue)

Parameters#

@paraminitialCngxDensityValue= 'comfortable'

Returns#

EnvironmentProviders