Appearance customization for Components
Change colors, typography and more to match your brand.
This feature of Mollie Components is in private beta. If you are interested in early access you can reach out to us.
Mollie Components use CSS Custom Properties (variables) for styling, allowing you to easily customize the look and feel to match your brand. You can apply these styles globally across your entire site, scoped to specific containers, or configured for dark mode.
Global Customization
To apply styles universally across all Mollie components on your site, define the variables on the :root selector in your global CSS stylesheet.
:root {
--mollie-color-primary-background: #6c2bd9;
--mollie-color-primary-foreground: #ffffff;
--mollie-font-family: "'Segoe UI', Tahoma, sans-serif"
--mollie-font-size: 17px;
}Scoped Customization
To style a specific instance of a component without affecting others, define the variables on the element which mounts the component. You can use a CSS class, ID or inline style.
#card-component {
--mollie-color-primary-background: #6c2bd9;
--mollie-color-primary-foreground: #ffffff;
--mollie-font-family: "'Segoe UI', Tahoma, sans-serif"
--mollie-font-size: 17px;
}Inline style approach:
<div style="--mollie-color-primary-background: #6c2bd9; --mollie-color-primary-foreground: #ffffff;"></div>Dark mode
Dark mode can be handled using OS-level system preferences, explicit class/attribute toggles, or both.
OS System Preference
Use the @media (prefers-color-scheme: dark) media query to automatically switch variables based on the user's system settings.
/* Default / Light Mode */
:root {
--mollie-color-primary-background: #6c2bd9;
--mollie-color-primary-foreground: #ffffff;
--mollie-font-family: "'Segoe UI', Tahoma, sans-serif"
--mollie-font-size: 17px;
}
/* Media query approach */
@media (prefers-color-scheme: dark) {
:root {
--mollie-color-scheme: dark;
--mollie-color-primary-background: #ffffff;
--mollie-color-primary-foreground: #6c2bd9;
}
}Class or Data-Attribute Toggle
If your app supports a manual dark mode toggle, scope the variables to a class or data-theme attribute on the or tag.
/* Class-based approach */
.dark-mode {
--mollie-color-primary-background: #ffffff;
--mollie-color-primary-foreground: #6c2bd9;
}
/* Data-attribute approach */
[data-theme="dark"] {
--mollie-color-primary-background: #ffffff;
--mollie-color-primary-foreground: #6c2bd9;
}Variables
Below a list of all the variables that can be customized. Mollie Components may derive more detailed values automatically ensuring consistency.
If your website already defines CSS variables, you can pass these directly.
Example:--mollie-font-size: var(--my-app-typography-md)
Colors
All valid CSS color values are accepted, such as Hex, RGB, HSL and OKLCH.
| Token | Description |
|---|---|
--mollie-color-primary-background | Backround color used for primary buttons. |
--mollie-color-primary-foreground | Text color used for primary buttons. |
--mollie-color-secondary-background | Background color used for secondary buttons. |
--mollie-color-secondary-foreground | Text color for secondary buttons. |
--mollie-color-background | Base background color. |
--mollie-color-foreground | Base text color. |
--mollie-color-surface-background | Background color used for surfaces. |
--mollie-color-surface-foreground | Text color used for surfaces. |
--mollie-color-muted-background | Background color for muted surfaces. |
--mollie-color-muted-foreground | Text color for muted text. |
--mollie-color-input-background | Background color for input fields. |
--mollie-color-input-foreground | Text color for input fields |
--mollie-color-border | Border color used for inputs and surfaces. |
--mollie-color-ring | Color used for focus ring of input elements. |
--mollie-color-danger-background | Background color for error messages. |
--mollie-color-danger-foreground | Text color for error messages. |
Typography
| Token | Description |
|---|---|
--mollie-font-family | Font family for all text. Only system fonts are supported. |
--mollie-font-size | The base font-size. All font-sizes are derived from this value. |
--mollie-letter-spacing | Tracking for all text elements. |
Layout
| Token | Description |
|---|---|
--mollie-spacing | The base spacing value. All spacing are derived from this value. |
--mollie-radius | The base radius value. All radii are derived from this value. |
Updated 13 minutes ago