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:
- In your stylesheet, for the whole app. Set the variables on
:rootor on any element that contains the components. - With a theme switch. Put the class
la-lightorla-dark, or the attributedata-lumoauth-theme="light"or"dark", on an ancestor. Without one, the components follow the colour scheme of the operating system. - On one component, with the
appearanceprop.
The appearance prop
SignIn, SignUp, UserButton, UserAvatar and UserProfile accept appearance.
| Option | Type | Description |
|---|---|---|
theme | 'light' | 'dark' | Use the light or the dark theme for this component, whatever its ancestors say. |
variables | Record<string, string> | CSS variables to set on the component, for example {"--la-primary": "#4f46e5"}. |
className | string | A 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
| Variable | Description |
|---|---|
--la-bg | Background of cards and menus. |
--la-bg-subtle | Background of quiet areas, for example a card header. |
--la-bg-muted | Background of inputs that are disabled and of tags. |
--la-bg-hover | Background of a row or a button under the pointer. |
--la-border | Border of cards, inputs and dividers. |
--la-border-focus | Border of the input that has focus. |
--la-text | Main text. |
--la-text-secondary | Secondary text, for example a subtitle. |
--la-text-muted | Hints and placeholders. |
--la-primary | Fill of the main button. |
--la-primary-hover | Fill of the main button under the pointer. |
--la-primary-text | Text on the main button, and the initials in an avatar. |
--la-link | Links. |
--la-danger | Error text and the sign-out action. |
--la-danger-bg | Background of an error message. |
--la-success | Success text. |
--la-success-bg | Background of a success message. |
--la-badge-success-bg | Background of a positive badge. Its text is --la-badge-success-text. |
--la-badge-warning-bg | Background of a warning badge. Its text is --la-badge-warning-text. |
--la-badge-muted-bg | Background of a neutral badge. |
--la-overlay | The layer behind a menu. |
--la-card-shadow | Shadow of a card. |
Type, radius and motion
| Variable | Description |
|---|---|
--la-font-family | Font of every component. |
--la-font-size-sm … 2xl | The five sizes: sm, base, lg, xl and 2xl. |
--la-font-weight-normal | medium | semibold | The three weights. |
--la-radius-sm … full | Corner radius: sm, md, lg, xl and full. |
--la-shadow-sm … xl | Shadows: sm, md, lg and xl. |
--la-transition | Timing 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.