Skip to content

Styling Overview

GolemUI is a Headless CSS library with a courtesy layer. The default theme ships as plain CSS that you can use as-is, override selectively, or remove entirely. No matter what you do with the styles, widgets always work — ARIA attributes, keyboard navigation, event handling, and state management are baked into the widgets themselves, not the CSS.

  • Standard CSS — You can target any element with regular CSS selectors. No special techniques, no piercing, no workarounds needed.
  • Predictable class names — Widgets use consistent classes like .gui-form, .gui-widget, .gui-button, .gui-repeater__card, and .gui-widget--horizontal that you can target directly.
  • CSS custom properties — The entire design system is expressed through CSS variables defined on :root. Change a variable, and every widget that references it updates automatically.

Import the CSS file in your project:

@import '@golemui/gui-components/index.css';

That single import gives you the full courtesy layer — every widget is styled and ready to use.

The index.css file bundles everything you need in a single import:

What you getDescription
Design tokensColors, spacing, typography, border radii, and shadows as CSS variables
Responsive scalingSpacing and font sizes automatically adjust on smaller screens
RTL supportRight-to-left layout for Arabic, Hebrew, and similar languages
Form layoutBase form container that adapts to its available width
Input stylingStyled inputs, labels, hints, and shared field patterns
Widget stylesVisual styles for every widget (button, textinput, calendar, toggle, etc.)
Validation stylesError message formatting and invalid-state indicators

The default is light. Dark mode is opt-in via a single data-theme attribute — "dark" forces dark, "auto" follows the user’s system preference, no attribute keeps things light. Every semantic token has both a light and a dark value; once dark tokens are applied, widgets switch over seamlessly.

See Theming / Dark mode for the full opt-in table and rationale.

GolemUI adapts to different screen sizes using two complementary strategies: media queries for global token scaling, and container queries for widget-level layout adaptation.

GolemUI defines four breakpoint reference tokens:

TokenValue
--gui-bp-sm640px
--gui-bp-md768px
--gui-bp-lg1024px
--gui-bp-xl1280px

At smaller viewport sizes, spacing and typography tokens automatically scale down to keep the UI compact and readable.

At 768px and below:

TokenDefaultScaled to
--gui-space-61.5rem (24px)1.25rem (20px)
--gui-space-82rem (32px)1.5rem (24px)
--gui-space-102.5rem (40px)2rem (32px)

At 640px and below:

TokenDefaultScaled to
--gui-space-41rem (16px)0.75rem (12px)
--gui-space-61.5rem (24px)1rem (16px)
--gui-space-82rem (32px)1.25rem (20px)
--gui-space-102.5rem (40px)1.5rem (24px)
--gui-font-2xl1.5rem (24px)1.25rem (20px)
--gui-font-3xl2rem (32px)1.5rem (24px)

GolemUI forms respond to their container width, not just the viewport. A form placed in a narrow sidebar adapts correctly even on a wide screen.

When the form container is 480px or narrower:

ComponentBehavior
Horizontal fieldsSwitch from row to column layout
Flex rowsStack vertically
CalendarsExpand to full container width
Tab buttonsReduce padding and font size

GolemUI supports right-to-left layouts for languages like Arabic, Hebrew, and Persian. When you set the localization property to a translator configured for an RTL language, the form switches direction automatically.

i18next.init({
fallbackLng: 'fa',
fa: {
translation: {
rtl: { username: 'نام کاربری', password: 'رمز عبور' },
},
},
});
const localization = { /* i18next implementation */ };
const config = { formDef, data: formData, formConfig, localization };
export function FormPage() {
return <GuiForm config={config} />;
}

All widgets mirror automatically in RTL mode — no additional CSS needed on your side.

AreaWhat adapts
Text and inputsPadding and alignment flip to match reading direction
Icons and arrowsSelect arrows, date-picker icons, and toggle sliders reposition
ButtonsRepeater action buttons align to the correct side
CalendarMonth navigation arrows mirror direction

For full i18n setup, see Features / i18n.

Skip the CSS import entirely and you enter headless mode — widgets render unstyled but functional. You write all the CSS yourself, targeting the BEM class names that widgets render.

This is the most powerful customization mode: full control, no fighting the courtesy layer. See Going Headless for the full walkthrough.

  • Theming — Built-in themes (Clay), creating new themes, scoped themes.
  • Customization — Override styles with CSS variables, class selectors, design tokens, and icon customization.
  • Going Headless — Build a theme from scratch.