Skip to content

@gluonjs/core / packages/atoms/src / UiStyleSelection

Interface: UiStyleSelection ​

Extends ​

Properties ​

entries ​

readonly entries: readonly StyleSheetSelectionEntry[]

Inherited from ​

StyleSheetSelection.entries


scope ​

readonly scope: "gluon-ui"


theme ​

readonly theme: UiThemeName


version ​

readonly version: 1

Inherited from ​

StyleSheetSelection.version

Example ​

Share the selected UI theme and four named style entries between server serialization and browser ownership:

ts
import {
  UiHydrationError,
  createUiStyleSelection,
  installUi,
  type InstallUiOptions,
  type UiHydrationMismatch,
  type UiOwner,
  type UiStyleSelection,
} from '@gluonjs/atoms';

const options = { theme: 'dark', hydrate: false } satisfies InstallUiOptions;
const selection: UiStyleSelection = createUiStyleSelection(options.theme);
const owner: UiOwner = installUi(document, options);
owner.setTheme('light');
console.log(selection.entries.map((entry) => entry.id), owner.theme, owner.themeSheet);
owner.dispose();

const mismatch: UiHydrationMismatch = 'missing';
const diagnostic = new UiHydrationError(mismatch, 'The server omitted the UI theme carrier.');
console.error(diagnostic.code, diagnostic.mismatch);

Version-matched documentation. Examples are checked against the public package contracts.