BrowseProvider

Core

Glass Provider

Holds the theme, glass mode and accessibility settings the whole app shares.

Preview

Installation

Install the package once, then import the parts you use into a standalone component.

Install

npm install ngx-vitreo @angular/cdk @floating-ui/dom
Import

import { GlassPreferences, GlassProvider, GlassLiquidFilters } from 'ngx-vitreo';

@Component({
  imports: [GlassPreferences, GlassProvider, GlassLiquidFilters],
  // ...
})

Usage

Usage

// app.config.ts
export const appConfig: ApplicationConfig = {
  providers: [provideVitreo({ defaultTheme: 'light' })],
};

// any component
const glass = inject(GlassPreferences);
glass.setPreferences({ theme: 'dark' });

API reference

provideVitreo

provideVitreo(options?)

InputTypeDefaultDescription
light'motion' | 'fixed''motion'What moves the light the rim highlights are lit by: the device tilt (still on a desktop), or nothing.
defaultTheme'light' | 'dark' system setting Theme a visitor sees until they choose one; without it the provider follows prefers-color-scheme. A saved choice always wins.

GlassPreferences

inject(GlassPreferences)

InputTypeDefaultDescription
preferencesSignal<Required<VitreoPreferences>>Nonetheme, mode, quality, reduceMotion, reduceTransparency and thickness, resolved from the visitor’s choices, the system and the defaults.
setPreferences(prefs: Partial<VitreoPreferences>) => voidNoneMerges and applies the given preferences, and saves them to localStorage under vitreo-preferences.
activeSignal<boolean>falseWhether a provider holds the preferences. Without one, glass reads the defaults and the system reduced-transparency setting, and setPreferences does nothing.

GlassProvider

<glass-provider>

InputTypeDefaultDescription
defaultTheme'light' | 'dark' system setting Template form of provideVitreo().

GlassLiquidFilters

<glass-liquid-filters>