spartan
DocsComponentsBlocksColorsStack
Twitter2.4k
Getting Started
  • Introduction
  • Changelog
  • About & Credits
UI
  • Installation
  • components.json
  • Theming
  • Dark Mode
  • CLI
  • Typography
  • Figma
  • Version Support
  • Health Checks
  • Update Guide
Components
  • Accordion
  • Alert
  • Alert Dialog
  • Aspect Ratio
  • Autocomplete
  • Avatar
  • Badge
  • Breadcrumb
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Checkbox
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Data Table
  • Date Picker
  • Dialog
  • Dropdown Menu
  • Empty
  • Field
  • Form Field
  • Hover Card
  • Icon
  • Input Group
  • Input OTP
  • Input
  • Item
  • Kbd
  • Label
  • Menubar
  • Native Select
  • Navigation Menu
  • Pagination
  • Popover
  • Progress
  • Radio Group
  • Resizable
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Skeleton
  • Slider
  • Sonner (Toast)
  • Spinner
  • Switch
  • Table
  • Tabs
  • Textarea
  • Toggle
  • Toggle Group
  • Tooltip
Forms
  • Forms
  • Reactive Forms
Stack
  • Overview
  • Technologies
  • Installation

Dark Mode

Toggle between light and dark themes with a single class.

spartan/ui supports dark mode out of the box. Add the dark class to your <html> element, and all CSS variables automatically switch to their dark mode values.

No component changes required. All spartan primitives adapt automatically.

Implementation

For a complete implementation including:

  • Persisting user preference with localStorage
  • Respecting system color scheme
  • Preventing theme flash on SSR
  • Angular service with signals

See this comprehensive guide: Dark mode with Angular & Tailwind

CLI Theming
Development powered by Zerops. Open source and available on GitHub.