Vvcare/ui
Documentation menu

Components

Getting Started

Theming

Everything is a CSS variable, switched by three attributes on <html>.

How it works

Components never use raw colors or fixed heights. They use classes such as bg-primary, h-control and shadow-raised, which resolve to CSS variables. The theme sets those variables from three attributes:

<html data-mode="light" data-accent="navy" data-density="compact">
  • data-mode: light or dark. Also add the dark class in dark mode, for dark: utilities.
  • data-accent: navy, teal, slate, neutral, forest, indigo or rose. Each changes the primary color, the charts and the light surfaces.
  • data-density: compact (the app's default) or comfortable. Changes control, row and nav heights.

Try them all on the themes page.

Install

npx shadcn@latest add @vcare/vcare-theme

This writes styles/vcare.css. Import it after Tailwind, and load the fonts (Google Sans, with Geist as fallback):

@import "tailwindcss";
@import "@fontsource/google-sans/400.css";
@import "@fontsource/google-sans/500.css";
@import "@fontsource/google-sans/600.css";
@import "@fontsource/google-sans/700.css";
@import "@fontsource-variable/geist";
@import "./styles/vcare.css";

From React

ThemeProvider (in @vcare/theme-provider) sets the attributes for you, remembers the choice and can load a Google font:

import { ThemeProvider, useTheme } from "@/lib/theme-provider"

<ThemeProvider>
  <App />
</ThemeProvider>

const { theme, setTheme } = useTheme()
setTheme({ ...theme, accent: "teal", mode: "dark" })

Token reference

TokenUsed for
--background / foregroundPage background and default text.
--card / popoverSurfaces: cards, menus, dialogs.
--primary / primary-hover / primary-foregroundActions and highlights. Follows the accent.
--secondary, muted, accentQuieter surfaces and hover states.
--success, warning, danger, destructiveStatus colors.
--chart-1 … chart-5Series colors for every chart.
--tag-<color>-bg / -border / -textThe Tag palette (blue, green, amber, red, purple…).
--sidebar, nav-active-bg / -fg / -shadowSidebar and the active item in any navigation.
--control-h, control-h-sm, control-h-lgHeights of buttons, inputs and selects (h-control).
--row-h, head-h, nav-h, header-h, chip-hTable rows, headers, nav items, page header, chips.
--shadow-raised, shadow-border, shadow-overlayThe raised pill and card shadows.
--radiusBase corner radius; the scale derives from it.

Website theme

The marketing sections use the website's own look (Onest, a larger type scale, softer cards). It lives in @vcare/site-theme and only applies inside a .vc-site wrapper, so app screens and marketing pages can share one stylesheet.

<div className="vc-site">
  <Hero appUrl="/demo" />
  <Departments />
</div>

Make your own accent

  1. Copy one [data-accent='…'] block in vcare.css and give it a new name.
  2. Change --primary, --primary-hover, --ring and the --chart-* values.
  3. Add the name to ACCENTS in lib/themes.ts so the pickers offer it.