Kumbatio
Quickstarts

CSS

The reference stylesheet - energy-aware chrome classes, presence attributes, and CSS custom properties.

The package ships a reference stylesheet that implements the UI visibility strategy in pure CSS. Set data-energy-level on a root element (the DOM adapter or React provider does this for you) and annotated elements adapt automatically.

Import

import '@kumbatio/energy-system/css'

The stylesheet is one way to consume energy state, not the only one. You can instead resolve uiVisibilityStrategy in JS and style however you want - both paths use the same values, so they always agree.

Chrome classes

Apply these classes to your layout; the stylesheet progressively de-emphasizes and hides them as the level drops:

ClassUse for
.energy-chromeAny chrome element (titlebar, toolbar, status bar) - fades with level, restores on hover
.energy-sidebarSidebar container - hidden at 25 and 0
.energy-tab-barTab bar - hidden at 25 and 0
.energy-status-barStatus bar - hidden at 25 and 0
.energy-toolbarApp/editor toolbar - hidden at 0
.energy-contentMain content area - narrows and scales up type at lower levels
<body data-energy-level="25">
  <aside class="energy-sidebar">…hidden at this level…</aside>
  <header class="energy-chrome energy-toolbar">…at 10% opacity, 100% on hover…</header>
  <main class="energy-content">…80ch wide, slightly larger type…</main>
</body>

Presence attributes: data-energy-min / data-energy-max

Annotate any element with the energy range it belongs to. No JS needed - the stylesheet hides it whenever the root's data-energy-level falls outside the range:

<div data-energy-min="75">AI chat - needs 75+ energy</div>
<div data-energy-max="25">Recovery hint - low energy only</div>
  • data-energy-min="75" - hidden whenever the current level is below 75
  • data-energy-max="25" - hidden whenever the current level is above 25

This is the CSS mirror of presenceAtOrAbove / presenceAtOrBelow - the two paths agree by definition. See Presence.

Resolved-presence hooks: data-energy-presence

When you resolve presence in JS (resolveEnergyPresence, useEnergyPresence) and want CSS to handle the treatment, stamp the result on the element:

<div data-energy-presence="muted">De-emphasized at 50% opacity</div>
<div data-energy-presence="hidden">Not rendered</div>

The muted opacity is controlled by --energy-muted-opacity (default 0.5).

Custom properties

The stylesheet defines these per level, mirroring uiVisibilityStrategy - use them in your own rules:

Property1007550250
--energy-chrome-opacity10.70.40.10.05
--energy-chrome-opacity-hover11110.8
--energy-content-max-widthnonenone90ch80ch75ch
--energy-content-font-scale1111.051.1
.my-panel {
  opacity: var(--energy-chrome-opacity, 1);
}

Reduced motion

The stylesheet honours prefers-reduced-motion: reduce for its own opacity transitions. If your app animates presence changes, honour the same preference.