Skip to main content

Theming

Change colours, radius and type with CSS variables, choose light or dark, or override one component with the appearance prop.

Every component reads CSS variables that start with --la-. You can set them in three places:

  1. In your stylesheet, for the whole app. Set the variables on :root or on any element that contains the components.
  2. With a theme switch. Put the class la-light or la-dark, or the attribute data-lumoauth-theme="light" or "dark", on an ancestor. Without one, the components follow the colour scheme of the operating system.
  3. On one component, with the appearance prop.

The appearance prop​

SignIn, SignUp, UserButton, UserAvatar and UserProfile accept appearance.

OptionTypeDescription
theme'light' | 'dark'Use the light or the dark theme for this component, whatever its ancestors say.
variablesRecord<string, string>CSS variables to set on the component, for example {"--la-primary": "#4f46e5"}.
classNamestringA class name to add to the root element of the component.

Set the variables in CSS​

app.css
:root {
--la-primary: #4f46e5;
--la-primary-hover: #4338ca;
--la-primary-text: #ffffff;
--la-radius-md: 10px;
--la-font-family: 'Inter', sans-serif;
}

/* Follow the theme switch of your own app */
[data-theme='dark'] {
--la-bg: #0b0b0f;
--la-text: #f4f4f5;
--la-border: #27272a;
}

Variables​

Colour​

VariableDescription
--la-bgBackground of cards and menus.
--la-bg-subtleBackground of quiet areas, for example a card header.
--la-bg-mutedBackground of inputs that are disabled and of tags.
--la-bg-hoverBackground of a row or a button under the pointer.
--la-borderBorder of cards, inputs and dividers.
--la-border-focusBorder of the input that has focus.
--la-textMain text.
--la-text-secondarySecondary text, for example a subtitle.
--la-text-mutedHints and placeholders.
--la-primaryFill of the main button.
--la-primary-hoverFill of the main button under the pointer.
--la-primary-textText on the main button, and the initials in an avatar.
--la-linkLinks.
--la-dangerError text and the sign-out action.
--la-danger-bgBackground of an error message.
--la-successSuccess text.
--la-success-bgBackground of a success message.
--la-badge-success-bgBackground of a positive badge. Its text is --la-badge-success-text.
--la-badge-warning-bgBackground of a warning badge. Its text is --la-badge-warning-text.
--la-badge-muted-bgBackground of a neutral badge.
--la-overlayThe layer behind a menu.
--la-card-shadowShadow of a card.

Type, radius and motion​

VariableDescription
--la-font-familyFont of every component.
--la-font-size-sm … 2xlThe five sizes: sm, base, lg, xl and 2xl.
--la-font-weight-normal | medium | semiboldThe three weights.
--la-radius-sm … fullCorner radius: sm, md, lg, xl and full.
--la-shadow-sm … xlShadows: sm, md, lg and xl.
--la-transitionTiming of hover and focus changes.

Class names​

Every element has a class that starts with la-, for example la-card, la-input, la-btn-primary and la-user-dropdown. Use them for changes that the variables do not cover. Variables are the stable way to theme: prefer them where one exists.