Customization methods
Bulma provides three main customization approaches:Sass variables
Compile-time customization by overriding Sass variables before importing Bulma.
CSS custom properties
Runtime customization using CSS variables for dynamic theming.
Theme system
Built-in light and dark themes with automatic switching.
Sass variables
The most powerful customization method. Override Sass variables before importing Bulma to change any aspect of the framework.Initial variables
Customize foundational settings like colors, typography, and spacing.src/styles/main.scss
Color system
Bulma uses HSL colors defined with hue, saturation, and lightness values:Bulma v1.0+ uses HSL color format extensively, which makes it easier to generate color variations and support themes.
Component-specific variables
Every component has its own set of variables. For example, button customization:Available variable categories
Initial variables (sass/utilities/initial-variables.scss)
Initial variables (sass/utilities/initial-variables.scss)
Core settings that affect the entire framework:
- Colors:
$black,$white,$grey,$primary,$link, etc. - Typography:
$family-sans-serif,$family-monospace,$size-1through$size-7,$weight-lightthrough$weight-extrabold - Spacing:
$block-spacing,$gap - Responsiveness:
$tablet,$desktop,$widescreen,$fullhd - Miscellaneous:
$radius,$radius-small,$radius-large,$radius-rounded,$speed,$duration
Derived variables (sass/utilities/derived-variables.scss)
Derived variables (sass/utilities/derived-variables.scss)
Variables computed from initial variables:
- Color schemes and contrasts
- Responsive breakpoint calculations
- Derived spacing values
Component variables
Component variables
Each component has its own variables:
- Button: Padding, border, shadow, colors
- Card: Radius, shadow, padding, colors
- Navbar: Height, padding, breakpoint
- Modal: Background color, content width
- And many more…
sass/elements/ and sass/components/ for available variables.CSS custom properties
Bulma v1.0+ generates CSS custom properties (CSS variables) for runtime customization. This allows you to change values dynamically without recompiling.How it works
Bulma automatically generates CSS variables with the--bulma- prefix:
Override CSS variables
You can override these variables in your CSS to customize Bulma at runtime:Dynamic theming example
Create custom themes by overriding CSS variables:Theme system
Bulma v1.0+ includes a built-in theme system with light and dark modes.How themes work
Bulma defines theme-specific variables that automatically adjust based on the active theme:sass/themes/light.scss
sass/themes/dark.scss
Enable dark mode
Add thedark-mode class to your root element:
Automatic theme switching
Respect user’s system preference with theprefers-color-scheme media query:
JavaScript theme toggle
Implement a theme switcher:Disable dark mode
If you don’t need dark mode, use thebulma-no-dark-mode.css version:
Prefix customization
Customize class name prefixes to avoid conflicts with other frameworks.Class prefix
Change the class prefix from empty string to your own:CSS variable prefix
Change the CSS variable prefix:Helper prefix
Customize theis- and has- prefixes:
Build optimization
Optimize your Bulma build by importing only what you need.Minimal build
Import only essential modules:Exclude helpers
If you use utility classes from another framework (like Tailwind), exclude Bulma’s helpers:Best practices
Use Sass variables for compile-time customization
Use Sass variables for compile-time customization
If your design is fixed and won’t change at runtime, use Sass variables for the best performance and smallest file size.
Use CSS custom properties for runtime changes
Use CSS custom properties for runtime changes
If you need theme switching, user customization, or dynamic styling, use CSS custom properties.
Combine both approaches
Combine both approaches
Override Sass variables for your base design, then use CSS custom properties for runtime variations:
Test in both light and dark themes
Test in both light and dark themes
If you’re using the theme system, always test your customizations in both themes to ensure readability and accessibility.
Example: Complete custom theme
Here’s a complete example combining all customization methods:src/styles/custom-bulma.scss
Next steps
Component documentation
Explore all Bulma components and their options
Sass documentation
Deep dive into Bulma’s Sass architecture
