Settings

Sidebar
Display
Profile Panel
👤

John Doe

Administrator
  • 📊 Dashboard
  • 📝 Forms
  • 📋 Tables
Commands
🚀
Go to Page
Navigate to a page
/go
🌓
Toggle Theme
Switch between light and dark mode
/theme
📐
Toggle Sidebar
Show or hide the sidebar
/sidebar
⚙️
Open Settings
Open the settings panel
/settings
Search In
📄
Pages
Search pages
:p
🧩
Components
Search component pages
:c

Base CSS Variables for Web Components

Pure Admin exports --base-* CSS custom properties that enable automatic theming for web components like web-daterangepicker, web-multiselect, and others.

How It Works

Architecture

  1. Pure Admin defines SCSS variables - $base-* variables in _variables.scss
  2. Themes override as needed - Each theme can customize these base variables
  3. Mixin outputs CSS properties - _base-css-variables.scss converts SCSS to CSS
  4. Web components consume - Components use var(--base-*, fallback)

Data Flow

_variables.scss          themes/express.scss           Output CSS
────────────────        ─────────────────────        ─────────────
$base-accent-color:     $base-accent-color:          :root {
  #3b82f6 !default;  →    #dc2626;               →    --base-accent-color: #dc2626;
                        @include output-base-vars;     ...
                                                     }

Web Component Consumption

/* In web component CSS */
:host {
    --ms-accent-color: var(--base-accent-color, #3b82f6);
    --ms-text-color: var(--base-text-color-1, #333);
    --ms-input-bg: var(--base-input-background, #fff);
}

Variable Reference

CategoryCountVariables
Colors11--base-accent-color, --base-accent-color-hover, --base-accent-color-active, --base-primary-bg, --base-primary-bg-hover, --base-text-color-1 to --base-text-color-4, --base-text-on-accent, --base-border-color
Input Fields7--base-input-background, --base-input-color, --base-input-border, --base-input-border-hover, --base-input-border-focus, --base-input-placeholder-color, --base-input-background-disabled
Input Sizes5--base-input-size-xs-height (3.1), --base-input-size-sm-height (3.3), --base-input-size-md-height (3.5), --base-input-size-lg-height (3.8), --base-input-size-xl-height (4.1)
Unitless multipliers for 10px base
Dropdown3--base-dropdown-background, --base-dropdown-border, --base-dropdown-box-shadow
Tooltip2--base-tooltip-background, --base-tooltip-text-color
Typography14--base-font-family, --base-font-size-2xs to --base-font-size-2xl (unitless), --base-font-weight-normal, --base-font-weight-medium, --base-font-weight-semibold, --base-line-height-tight, --base-line-height-normal, --base-line-height-relaxed
Border Radius3--base-border-radius-sm (0.4), --base-border-radius-md (0.6), --base-border-radius-lg (0.8)
Unitless multipliers for 10px base
Total45

Current Theme Values

These are the --base-* CSS variable values from the currently selected theme:

Colors

--base-accent-color
--base-accent-color-hover
--base-primary-bg
--base-border-color

Text Colors

--base-text-color-1
--base-text-color-2
--base-text-color-3
--base-text-color-4

Input Fields

--base-input-background
--base-dropdown-background
--base-tooltip-background

Typography

--base-font-size-2xs (1.0)

--base-font-size-xs (1.2)

--base-font-size-sm (1.4)

--base-font-size-base (1.6)

--base-font-size-lg (1.8)

Theme Implementation Pattern

Each theme follows this pattern to output base CSS variables:

// themes/express.scss
@import '../variables';

// Override accent color for theme
$accent-color: $express-red;

// Sync base variables with theme colors
$base-accent-color: $accent-color;
$base-accent-color-hover: $express-red-hover;
$base-accent-color-active: lighten($express-red, 15%);

// ... other theme overrides ...

@import '../core';
@import '../utilities';
@import '../base-css-variables';

// Output CSS variables in :root block
:root {
    --page-loader-bg: rgba(0, 0, 0, 0.95);
    --page-loader-spinner-border: #333;
    --page-loader-spinner-accent: #FFCC00;

    // Base CSS variables for web components
    @include output-base-css-variables;
}

Files Reference

FilePurpose
src/scss/_variables.scssContains 45 $base-* SCSS variables with !default flags
src/scss/_base-css-variables.scssMixin output-base-css-variables that outputs all CSS custom properties
src/scss/themes/*.scssEach theme imports the mixin and includes it in :root
docs/BASE_VARIABLES_INTEGRATION_PLAN.mdComplete implementation plan and architecture documentation

Benefits

Keyboard Shortcuts

No shortcuts registered.