Skip to the content

GlobalStyle

GlobalStyle emits the page-level styles: a normalize reset, the fixed 100% root, the page ground and primary ink from the surface ladder (surface.canvas, ink.primary), the theme font on html, body, the motion variables, and the color-scheme rules the mode engine switches on. Render it once, inside ApollionProvider, so it can read the mode attribute and preference.
Theming

Usage

import { css } from 'styled-components';
import { ApollionProvider, GlobalStyle } from '@apollion-dsi/core/themes';

<ApollionProvider>
  <GlobalStyle
    extend={css`
      body {
        font-family: ${({ theme }) => theme.font.fontFamily.code};
      }
    `}
  />
  <App />
</ApollionProvider>;

extend is the only prop: a styled-components css block appended to the global styles, with the theme available.

Cascade layer

The reset — normalize, box-sizing inheritance, and font: inherit on button, input, select and textarea — is emitted inside the apollion.reset cascade layer. Any unlayered CSS of yours wins over it regardless of specificity, so button { font-size: 1rem } beats the reset. Component styles and the rest of GlobalStyle stay unlayered. One rule is emitted outside the layer, [hidden] { display: none }, so an unlayered display cannot reveal a hidden element.

If your app declares cascade layers of its own (Tailwind CSS v4, for example), state the order once, before any other CSS, with the reset first:

@layer apollion.reset, theme, base, components, utilities;

Without that statement the first layer the browser meets ranks lowest, and the styled-components <style> tag usually arrives after your stylesheet.

See also