Skip to Content

Theming & Dark Mode


v3 Breaking Change — Theming architecture

Theming has moved from JavaScript config objects to CSS Custom Properties. Any theme prop or SCSS variable overrides from v1/v2 will no longer work. Override the --rsp-* variables in your CSS instead (see below).

React Scheduler Pro uses CSS Custom Properties (CSS Variables) for full theming support. Customize every color, font, and spacing value without writing a single line of SCSS.

CSS Variables

All variables use the --rsp- prefix. Override them in your CSS:

:root {
--rsp-primary: #6366f1;
--rsp-bg: #ffffff;
--rsp-text: #1e293b;
--rsp-border-color: rgba(0, 0, 0, 0.1);
--rsp-event-bg: #6366f1;
--rsp-event-text: #ffffff;
--rsp-font-family: 'Inter', sans-serif;
}

Available Variables

Colors

VariableDefaultDescription
--rsp-primary#0079ffPrimary accent color
--rsp-primary-light#e0f4ffLight variant of primary
--rsp-primary-dark#0056b3Dark variant of primary
--rsp-bg#ffffffBackground color
--rsp-bg-secondary#f8f9faSecondary background
--rsp-bg-hover#e0f4ffHover state background
--rsp-text#1d1d1dPrimary text color
--rsp-text-secondaryrgba(0,0,0,0.54)Secondary text color
--rsp-text-inverse#ffffffInverse text (on dark bg)
--rsp-border-colorrgba(0,0,0,0.12)Border color

Events

VariableDefaultDescription
--rsp-event-bg#0079ffDefault event background
--rsp-event-text#ffffffEvent text color
--rsp-event-border#e8eaf6Event border color
--rsp-event-radius4pxEvent border radius

Typography

VariableDefaultDescription
--rsp-font-family'Muli', sans-serifFont family
--rsp-font-size-sm12pxSmall text
--rsp-font-size-md13pxMedium text
--rsp-font-size-lg14pxLarge text

Layout

VariableDefaultDescription
--rsp-cell-height50pxTime cell height
--rsp-header-height40pxHeader height
--rsp-shadow0 2px 8px rgba(0,0,0,0.15)Default shadow

Dark Mode

Using data-theme attribute

Add data-theme="dark" to any parent element:

<div data-theme="dark">
<Scheduler events="{events}" fields="{fields}" />
</div>

Using CSS class

Add the .rsp-dark class:

<div className="rsp-dark">
<Scheduler events="{events}" fields="{fields}" />
</div>

With next-themes or similar

import { useTheme } from 'next-themes';
function App() {
const { theme } = useTheme();
return (
<div data-theme={theme}>
<Scheduler events={events} fields={fields} />
</div>
);
}

Custom Theme Example

Create a purple theme:

.scheduler-purple {
--rsp-primary: #7c3aed;
--rsp-primary-light: #ede9fe;
--rsp-primary-dark: #5b21b6;
--rsp-event-bg: #7c3aed;
--rsp-bg-hover: #ede9fe;
--rsp-font-family: 'Inter', sans-serif;
}
<div className="scheduler-purple">
<Scheduler events={events} fields={fields} />
</div>

© 2024 Released under the MIT license