RefactKit’s design system is built on three layers: Base UI primitives for accessible component behavior, Tailwind CSS v4 for utility-class styling, and a Shadcn theme layer that maps semantic CSS custom properties to Tailwind color tokens. Because all color and typography values flow through CSS variables, you can change the entire visual identity of your app by swapping a single theme preset — without touching any component code.Documentation Index
Fetch the complete documentation index at: https://docs.refactkit.com/llms.txt
Use this file to discover all available pages before exploring further.
How the theme layer works
src/styles/globals.css defines two sets of CSS custom properties: one on :root for the light theme and one on .dark for the dark theme. Tailwind’s @theme block then maps those variables to utility classes:
src/styles/globals.css
--primary value in :root and .dark automatically updates every component that uses bg-primary, text-primary, or border-primary across the entire app.
Semantic color tokens
Always use semantic tokens instead of hardcoded palette values. The full set of tokens available in RefactKit:| Token | Utility classes | Purpose |
|---|---|---|
--background / --foreground | bg-background, text-foreground | Page canvas and body text |
--card / --card-foreground | bg-card, text-card-foreground | Card surfaces |
--primary / --primary-foreground | bg-primary, text-primary-foreground | Brand actions, active states |
--secondary / --secondary-foreground | bg-secondary, text-secondary-foreground | Secondary actions |
--muted / --muted-foreground | bg-muted, text-muted-foreground | Subdued surfaces and helper text |
--accent / --accent-foreground | bg-accent, text-accent-foreground | Hover states and highlights |
--destructive | bg-destructive, text-destructive | Danger and error states |
--border | border-border | All borders |
--ring | ring-ring | Focus rings |
--sidebar-* | bg-sidebar, text-sidebar-foreground, etc. | Sidebar-specific tokens |
Applying a new Shadcn theme preset
The fastest way to restyle RefactKit is to apply one of the theme presets from ui.shadcn.com/themes. Each preset replaces the:root and .dark variable blocks in your CSS.
Choose a preset
Visit ui.shadcn.com/themes, pick a theme,
and copy the generated preset code.
Apply the preset
Run the Shadcn CLI in the project root, substituting your copied code for
The CLI rewrites the
<preset-code>::root and .dark blocks in src/styles/globals.css
and leaves all component code untouched.Customizing fonts
RefactKit ships with five fontsource fonts pre-installed and auseFont hook that applies the user’s selection via a data-font attribute on <html>.
Built-in fonts
| Font key | Package | Display name |
|---|---|---|
default | (auto) | System default — Google Sans Flex (LTR) or Zain (RTL) |
google-sans | @fontsource-variable/google-sans-flex | Google Sans Flex |
zain | @fontsource/zain | Zain |
geist | @fontsource-variable/geist | Geist |
baloo | @fontsource/baloo-bhaijaan-2 | Baloo Bhaijaan 2 |
Adding a new font
Import the font in globals.css
Add the import at the top of
src/styles/globals.css, alongside the
existing imports:src/styles/globals.css
Register the CSS variable
Add a
data-font selector block to src/styles/globals.css:src/styles/globals.css
Add the key to the Font type
Open
src/hooks/use-font.ts and add "inter" to the Font union type:src/hooks/use-font.ts
How the font hook works
useFont (src/hooks/use-font.ts) stores the user’s selection in localStorage under the key RefactKit-font and applies it by setting a data-font attribute on document.documentElement. The CSS [data-font="..."] selectors in globals.css pick up this attribute and set --font-family accordingly.
When data-font is absent (the default key), a direction-aware fallback activates automatically:
src/styles/globals.css
Light, dark, and system mode
Theme switching is handled by next-themes, which adds or removes thedark class on <html>. The Appearance component in src/components/settings/account/appearance.tsx exposes three options to users — System, Light, and Dark — using the useTheme hook from next-themes.
src/components/settings/account/appearance.tsx
dark: variant classes in your own components. Because both :root and .dark define the same set of semantic tokens, every bg-primary or text-muted-foreground class automatically reflects the active mode.
Spacing and layout conventions
Follow these rules when building new UI in RefactKit to stay consistent with the component library:- Use
flex+gap-*for spacing between elements. Do not usespace-y-*orspace-x-*. - Use
size-*for equal-dimension elements. For example,size-10instead ofw-10 h-10. - Use
data-icon="inline-start"when placing icons inside buttons. This is a Base UI convention for correct icon alignment.

