Skip to content

Customizing StudioCMS UI

StudioCMS UI is designed on top of CSS variables, which makes it easy to customize the look of the components to match your brand. You can customize the colors, typography, radii, and more. All customization is done with a custom CSS file that you can provide to the UI integration:

astro.config.mjs
import { defineConfig } from 'astro/config';
import ui from '@studiocms/ui';
export default defineConfig({
integrations: [
ui({
customCss: './path/to/custom.css'
})
]
});

In that file, you can override the CSS variables to change the look of the components. If you wanted to overwrite the primary color, it’d look like this:

custom.css
:root {
--primary-base: hsl(0 0% 100%);
--primary-hover: hsl(0 0% 80%);
--primary-active: hsl(0 0% 90%);
}
[data-theme='light'] :root {
--primary-base: hsl(0 0% 0%);
--primary-hover: hsl(0 0% 20%);
--primary-active: hsl(0 0% 10%);
}

If you make significant changes to the colors, remember to also adjust the light theme.

Below, you will find all the CSS variables used in StudioCMS UI. Always make sure to provide them as HSL values without commas. You can use them in your CSS like this: background-color: var(--background-base);.

If you want to disable the CSS injection, you can do so by setting the noInjectCSS option to true:

astro.config.mjs
import {
function defineConfig<const TLocales extends Locales = never, const TDriver extends SessionDriverName = never>(config: AstroUserConfig<TLocales, TDriver>): AstroUserConfig<TLocales, TDriver>

See the full Astro Configuration API Documentation https://astro.build/config

defineConfig
} from 'astro/config';
import
function ui(options?: Options): AstroIntegration

The Astro integration for StudioCMS UI.

@seehttps://ui.studiocms.dev

@paramoptions - The options for the integration.

@returnsThe Astro integration object.

ui
from '@studiocms/ui';
export default
defineConfig<never, never>(config: AstroUserConfig<never, never>): AstroUserConfig<never, never>

See the full Astro Configuration API Documentation https://astro.build/config

defineConfig
({
AstroUserConfig<TLocales extends Locales = never, TSession extends SessionDriverName = never>.integrations?: (false | AstroIntegration | (false | AstroIntegration | null | undefined)[] | null | undefined)[]

@nameintegrations

@description

Extend Astro with custom integrations. Integrations are your one-stop-shop for adding framework support (like Solid.js), new features (like sitemaps), and new libraries (like Partytown).

Read our Integrations Guide for help getting started with Astro Integrations.

import react from '@astrojs/react';
import tailwind from '@astrojs/tailwind';
{
// Example: Add React + Tailwind support to Astro
integrations: [react(), tailwind()]
}

integrations
: [
function ui(options?: Options): AstroIntegration

The Astro integration for StudioCMS UI.

@seehttps://ui.studiocms.dev

@paramoptions - The options for the integration.

@returnsThe Astro integration object.

ui
({
noInjectCSS?: boolean

Disable CSS Generation and require manual addition of the global CSS

@example

import 'studiocms:ui/global-css';

noInjectCSS
: true,
})
]
});

You can then include the CSS in your project manually. This is useful if you want to mix StudioCMS UI with other CSS frameworks, or if you are using the UI styling only for a subset of your components.

src/layouts/SUILayout.astro
---
// Using the virtual module to import the CSS file (recommended)
import "studiocms:ui/global-css";
// Alternatively, import the CSS file directly from the package
import "@studiocms/ui/css/global.css";
---

You can edit the colors in your own project during development using the dev toolbar. In the toolbar, you will find a tab with the StudioCMS logo on it. Once clicked it will reveal a few color pickers and inputs you can use to adjust various variables. You can copy your changes to your clipboard after you are done.

Dark Mode
VariableDescriptionDefault
--background-baseBase background colorhsl(0, 0%, 6%)
--background-step-1Background color step 1hsl(0, 0%, 8%)
--background-step-2Background color step 2hsl(0, 0%, 10%)
--background-step-3Background color step 3hsl(0, 0%, 14%)
--text-normalNormal text colorhsl(0, 0%, 100%)
--text-mutedMuted text colorhsl(0, 0%, 54%)
--text-invertedInverted text colorhsl(0, 0%, 0%)
--borderBorder colorhsl(240, 5%, 17%)
--shadowShadow colorhsl(0, 0%, 0% / 0.5)
--default-baseDefault color basehsl(0, 0%, 14%)
--default-hoverDefault color hoverhsl(0, 0%, 21%)
--default-activeDefault color activehsl(0, 0%, 15%)
--primary-basePrimary color basehsl(259, 83%, 73%)
--primary-hoverPrimary color hoverhsl(259, 77%, 78%)
--primary-activePrimary color activehsl(259, 73%, 67%)
--success-baseSuccess color basehsl(142, 71%, 46%)
--success-hoverSuccess color hoverhsl(142, 72%, 61%)
--success-activeSuccess color activehsl(142, 87%, 52%)
--warning-baseWarning color basehsl(48, 96%, 53%)
--warning-hoverWarning color hoverhsl(48, 97%, 70%)
--warning-activeWarning color activehsl(48, 100%, 61%)
--danger-baseDanger color basehsl(339, 97%, 31%)
--danger-hoverDanger color hoverhsl(337, 98%, 37%)
--danger-activeDanger color activehsl(337, 88%, 32%)
--info-baseInfo color basehsl(217, 92%, 52%)
--info-hoverInfo color hoverhsl(214, 95%, 58%)
--info-activeInfo color activehsl(214, 85%, 52%)
--mono-baseMono color basehsl(0, 0%, 100%)
--mono-hoverMono color hoverhsl(0, 0%, 90%)
--mono-activeMono color activehsl(0, 0%, 95%)
Light Mode
VariableDescriptionDefault
--background-baseBase background colorhsl(0, 0%, 97%)
--background-step-1Background color step 1hsl(0, 0%, 90%)
--background-step-2Background color step 2hsl(0, 0%, 85%)
--background-step-3Background color step 3hsl(0, 0%, 80%)
--text-normalNormal text colorhsl(0, 0%, 0%)
--text-mutedMuted text colorhsl(0, 0%, 24%)
--text-invertedInverted text colorhsl(0, 0%, 100%)
--borderBorder colorhsl(263, 5%, 68%)
--shadowShadow colorhsl(0, 0%, 65% / 0.5)
--default-baseDefault color basehsl(0, 0%, 74%)
--default-hoverDefault color hoverhsl(0, 0%, 81%)
--default-activeDefault color activehsl(0, 0%, 91%)
--primary-basePrimary color basehsl(259, 85%, 61%)
--primary-hoverPrimary color hoverhsl(259, 78%, 56%)
--primary-activePrimary color activehsl(259, 71%, 50%)
--success-baseSuccess color basehsl(142, 59%, 47%)
--success-hoverSuccess color hoverhsl(142, 62%, 56%)
--success-activeSuccess color activehsl(142, 87%, 59%)
--warning-baseWarning color basehsl(48, 92%, 46%)
--warning-hoverWarning color hoverhsl(48, 88%, 43%)
--warning-activeWarning color activehsl(48, 85%, 40%)
--danger-baseDanger color basehsl(339, 97%, 31%)
--danger-hoverDanger color hoverhsl(337, 98%, 37%)
--danger-activeDanger color activehsl(337, 88%, 45%)
--info-baseInfo color basehsl(217, 92%, 52%)
--info-hoverInfo color hoverhsl(214, 95%, 58%)
--info-activeInfo color activehsl(214, 85%, 52%)
--mono-baseMono color basehsl(0, 0%, 0%)
--mono-hoverMono color hoverhsl(0, 0%, 10%)
--mono-activeMono color activehsl(0, 0%, 5%)
Non-Themed Color Variables
VariableDescriptionDefault
--text-lightLight text colorhsl(0 0% 100%)
--text-darkDark text colorhsl(0 0% 0%)
--default-flatDefault flat colorhsl(0 0% 14% / 0.5)
--default-flat-hoverDefault flat hover colorhsl(0 0% 14% / 0.75)
--default-flat-activeDefault flat active colorhsl(0 0% 14% / 0.85)
--primary-flatPrimary flat colorhsl(259 83% 73% / 0.1)
--primary-flat-hoverPrimary flat hover colorhsl(259 83% 73% / 0.25)
--primary-flat-activePrimary flat active colorhsl(259 83% 73% / 0.35)
--success-flatSuccess flat colorhsl(142 71% 46% / 0.1)
--success-flat-hoverSuccess flat hover colorhsl(142 71% 46% / 0.25)
--success-flat-activeSuccess flat active colorhsl(142 71% 46% / 0.35)
--warning-flatWarning flat colorhsl(48 96% 53% / 0.1)
--warning-flat-hoverWarning flat hover colorhsl(48 96% 53% / 0.25)
--warning-flat-activeWarning flat active colorhsl(48 96% 53% / 0.35)
--danger-flatDanger flat colorhsl(339 97% 31% / 0.1)
--danger-flat-hoverDanger flat hover colorhsl(339 97% 31% / 0.25)
--danger-flat-activeDanger flat active colorhsl(339 97% 31% / 0.35)
--info-flatInfo flat colorhsl(217 92% 52% / 0.1)
--info-flat-hoverInfo flat hover colorhsl(217 92% 52% / 0.25)
--info-flat-activeInfo flat active colorhsl(217 92% 52% / 0.35)
--mono-flatInfo flat colorhsl(0 0% 100% / 0.1)
--mono-flat-hoverInfo flat hover colorhsl(0 0% 100% / 0.25)
--mono-flat-activeInfo flat active colorhsl(0 0% 100% / 0.35)
Radius Variables
VariableDescriptionDefault
--radius-smSmall radius.25rem
--radius-mdMedium radius.5rem
--radius-lgLarge radius1rem
--radius-fullFull radius999px