Theming and Customization
Relevant source files
The following files were used as context for generating this wiki page:
- packages/frontend-core/src/themes/nord.css
- packages/frontend-core/src/themes/midnight.css
- packages/builder/index.html
- packages/builder/src/constants/index.ts
- packages/bbui/README.md
- packages/builder/src/settings/pages/translations/translations.svelte
- packages/worker/src/constants/templates/tests/email_templates.yaml
Budibase provides a flexible theming and customization system that allows for visual and textual adjustments to the platform. The core of the visual theming is built upon CSS custom properties (variables), enabling both pre-defined themes and app-specific customizations. This system allows developers to create a consistent look and feel across applications.
Beyond visual styling, customization extends to user-facing text through UI translations and system-generated communications like email templates. This ensures that the entire user experience can be tailored to specific branding and language requirements.
Theme Architecture
The theming architecture is centered around CSS custom properties defined at the root level. A base set of themes, such as light and darkest, provide the foundation. Additional themes like nord and midnight extend these base themes by overriding specific CSS variables to create a different look and feel.
The active theme is applied as a class to the <html> element, for example, spectrum--darkest or spectrum--nord. This allows CSS rules to be scoped to the current theme.
Sources: packages/builder/index.html:10-20, packages/frontend-core/src/themes/nord.css, packages/bbui/README.md:14-15
Theme Loading and Persistence
The builder application loads the theme early in the page lifecycle to prevent a flash of unstyled content. The process is handled by an inline script in packages/builder/index.html.
This diagram illustrates the theme loading flow when the builder application starts.
The selected theme is persisted in the browser's localStorage under the key bb-theme.
Sources: packages/builder/index.html:11-53
Built-in Themes
Budibase includes several built-in themes. The light and darkest themes serve as base options, while others provide stylistic variations.
| Theme ID | Base Theme | Description |
|---|---|---|
light | - | A light base theme. |
darkest | - | A dark base theme, and the default fallback. |
nord | darkest | A dark theme based on the Nord color palette. |
midnight | darkest | A dark theme with a blueish-gray tone. |
Sources: packages/builder/index.html:13-17, packages/frontend-core/src/themes/nord.css, packages/frontend-core/src/themes/midnight.css
The nord and midnight themes work by overriding the default Spectrum CSS variables. For example, nord.css redefines colors for the dark theme.
/* packages/frontend-core/src/themes/nord.css:1-10 */
.spectrum--darkest.spectrum--nord {
/* Nord colors */
--nord0: #2e3440;
--nord1: #3b4252;
--nord2: #434c5e;
--nord3: #4c566a;
--nord4: #d8dee9;
--nord5: #e5e9f0;
--nord6: #eceff4;
/* ... more variables */
}
App-Specific Theming
In addition to the global builder theme, individual applications can have their own theme settings. A default set of theme properties is defined for all new apps.
The DefaultAppTheme object specifies these initial values.
| Property | Default Value | Description |
|---|---|---|
primaryColor | var(--spectrum-global-color-blue-600) | The main brand or accent color. |
primaryColorHover | var(--spectrum-global-color-blue-500) | The hover state for the primary color. |
buttonBorderRadius | 16px | The border-radius for buttons. |
navBackground | var(--spectrum-global-color-gray-50) | The background color for navigation elements. |
navTextColor | var(--spectrum-global-color-gray-800) | The text color for navigation elements. |
Sources: packages/builder/src/constants/index.ts:38-44
These values can be customized within the app builder to match specific branding requirements.
Component Styling Guidelines
To ensure that all UI components correctly adapt to the selected theme, the bbui component library follows a key guideline: always use CSS custom properties (variables) for styling instead of hard-coded values. This makes it easy to tweak styles globally and ensures that components are theme-aware.
Additionally, components should avoid adding margins to their outermost container to allow for flexible layout composition using css grid or wrapper elements.
Sources: packages/bbui/README.md:14-15, 21-24
Other Customizations
The concept of customization in Budibase extends beyond colors and styles to include user-facing text and communications.
UI Translations
Budibase offers a feature for Enterprise plans to define custom text for user-facing elements. This allows for overriding default strings in components like the user menu, profile modal, and password modal.
The translation management UI allows users to:
- Filter translations by category (
userMenu,profileModal, etc.) or search by keyword. - Edit the text for specific keys.
- Save the overrides, which are then applied across the workspace.
If a field is left blank, the system falls back to the Budibase default text.
| Category | Label |
|---|---|
userMenu | User menu |
profileModal | Profile modal |
passwordModal | Password modal |
picker | Picker |
Sources: packages/builder/src/settings/pages/translations/translations.svelte:14-27, 102-123
Email Templates
System-generated emails, such as password recovery and user invitations, are also customizable. The email templates are built using a base HTML structure with placeholders for dynamic content.
The system uses Handlebars for templating, allowing for logic and variable injection. A base template defines the overall layout, fonts, and responsive styles, while specific templates like password_recovery provide the body content.
This diagram shows the structure of an email template.
The base template includes styles for both light and dark modes, ensuring a good viewing experience in various email clients.
Sources: packages/worker/src/constants/templates/tests/email_templates.yaml:3-328