Theming
Stylesheet and tokens
@vojtechportes/react-query-builder/styles.cssImport this public stylesheet exactly once in the application entrypoint that renders v2 builders.@vojtechportes/react-query-builder/dark-mode.variables.cssOptional dark palette for built-in components. Import it afterstyles.cssbefore usingcolorScheme="dark".--query-builder-*Public inherited variables for colors, spacing, padding, gaps, radii, shadows, control sizing, typography, editor sizing, drop zones, motion, and popover layering.IBuilderStyleTypedReact.CSSPropertiesextension containing every public variable accepted byBuilder.style.- Override boundaries Declare variables globally, on an app-owned wrapper, or on one Builder through its
styleprop. - Stable selectors Use an app-owned
Builder.classNameor[data-query-builder="root"]. Generated CSS Module classes such asrqb_[local]_[hash]are private and can change between releases.
Legacy ThemeProvider
ThemeProvider
export type ThemeColorOverrides = {[Key in keyof IColors]?: IColors[Key] extends string? IColors[Key]: Partial<IColors[Key]>;};export interface IThemeProps<TColors extends ThemeColorOverrides = IColors,> {colors?: TColors;}/** @deprecated Prefer public --query-builder-* CSS variables. */export interface IThemeProviderPropsextends IThemeProps<ThemeColorOverrides> {children?: React.ReactNode;}/** @deprecated Prefer public --query-builder-* CSS variables. */export const ThemeProvider: React.FC<IThemeProviderProps>;
Color types
export interface IColorVariant {light: string;dark: string;default: string;contrastText: string;}export interface IGreyColorVariant {100: string;200: string;300: string;400: string;500: string;600: string;700: string;800: string;900: string;}export interface IColors {primary: IColorVariant;secondary: IColorVariant;grey: IGreyColorVariant;white: string;}export const colors: IColors;
Props and precedence
colorSchemeOptional'light' | 'dark'palette boundary for one Builder. Leave it undefined to preserve inherited variables.colorsOptional deep partial color overrides. Only provided leaves become CSS variables; omitted leaves continue to inherit from consumer CSS.childrenOptional React subtree that receives context without an added DOM node.- Nested providers The nearest provider replaces the outer context value. Missing legacy values resolve from the exported
colorsdefaults instead of the outer provider. - Precedence Base defaults, inherited variables, explicit light/dark scheme variables, consumer root classes, legacy provider colors, then
Builder.stylevalues. - Monaco note The packaged Monaco light and dark themes map SQL tokens to the same query-builder palette roles as the built-in editor. An undefined
colorSchemeuses the packaged light theme. Monaco's standalone theme service is global, so the latest mounted packaged editor, or the editor whose scheme changes most recently, wins across all mounted editors. Synchronizing consumer CSS variable overrides or custom per-editor themes remains application-managed. - Adapter note
ThemeProvideraffects the built-in default components. Packaged host-library adapters use their own theme systems.
Legacy theming
ThemeProvider is deprecated for new integrations. Map legacy color leaves to public --query-builder-color-* variables on a wrapper or Builder.style. The provider, exported colors, and color types stay available for the v2 compatibility cycle.Documentation