Xzero UI
Pro library

Split

The next appearance opens from a slim center seam.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/theme-switch-split
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/theme-switch-split

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { ThemeSwitch } from "@/components/xzero/theme-switch/theme-switch";

<ThemeSwitch
  theme={theme}
  variant="split"
  onThemeChange={(next, variant, trigger) => runThemeTransition(next, variant, trigger)}
/>

API reference

ThemeSwitch

A secondary Button that swaps a sun and moon icon and reports the next theme. The page transition itself is yours to run.

PropTypeDefaultDescription
theme (required)"light" | "dark"–The current theme. Drives the icon and aria-pressed.
onThemeChange (required)(next: Theme, variant: ThemeSwitchVariant, trigger: HTMLElement) => void–Called on press with the opposite theme, the variant, and the button, so the page transition can start from it.
variant"reveal" | "eclipse" | "split" | "rise""reveal"Names the page transition and sets the small icon nudge that matches it.
labelstring–Accessible name. Defaults to "Switch to dark mode" or "Switch to light mode".
iconOnlybooleanfalseHides the "Switch theme" text and renders a 38px square button.

Keyboard interactions

KeysAction
Enter / SpaceToggles the theme.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Split: The next appearance opens from a slim center seam. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components