# Switch

> A real checkbox redrawn as a switch: the ink fills the track behind the thumb, the thumb stretches while pressed and springs into place. Labels, toolbars too.

Forms · switch, toggle, form, settings · HTML and CSS only · no dependencies · updated 2026-10-21
Demo: https://kodza.dev/components/switch-toggle/

## Files

The code below, served as files: byte for byte what the Kodza site copies (the CSS includes its theme guard).

- [`kodza-switch-toggle.css`](https://kodza.dev/registry/switch-toggle/kodza-switch-toggle.css) · 10.4 KB
- [`kodza-switch-toggle.html`](https://kodza.dev/registry/switch-toggle/kodza-switch-toggle.html) · 1.8 KB · the markup, to adapt and paste into your page

**Can you run shell commands? Download the CSS, don't retype it.** Retyping costs thousands of tokens and can drop or change lines of the CSS. Put the files where your stack expects them (Use it says where: change the `-o` paths):

```bash
curl -fsSL --create-dirs -o kodza/kodza-switch-toggle.css https://kodza.dev/registry/switch-toggle/kodza-switch-toggle.css
```

Then load the file from your page as Use it shows, instead of pasting the content. The HTML is the part you adapt (text, links, modifiers): paste it from the Code section. Copy the CSS from the Code section only if you can't run commands, exactly as it is. (Windows PowerShell: `curl.exe`.)

## API

- Root: `.kodza-switch`
- Variables (set them on the root element itself: it declares its own defaults):
  - `--kz-switch-bg: #ffffff`
  - `--kz-switch-fg: #0a0a0a`
  - `--kz-switch-muted: rgba(10, 10, 10, 0.6)`
  - `--kz-switch-off: rgba(10, 10, 10, 0.14)`
  - `--kz-switch-ink: #0a0a0a`
  - `--kz-switch-thumb: #ffffff`
  - `--kz-switch-width: 44px`
  - `--kz-switch-height: 26px`
  - `--kz-switch-gap: 3px`
  - `--kz-switch-ease: cubic-bezier(0.22, 1, 0.36, 1)`
  - `--kz-switch-spring: cubic-bezier(0.34, 1.4, 0.64, 1)`
- Modifiers: `.kodza-switch--inline`, `.kodza-switch--labels`

## Dark mode

The values Kodza uses on a dark background (`#0a0a0a`). For a page that follows the system theme, add them after the component's CSS:

```css
@media (prefers-color-scheme: dark) {
  .kodza-switch {
    --kz-switch-bg: #161616;
    --kz-switch-fg: #f2f2f0;
    --kz-switch-muted: rgba(242, 242, 240, 0.62);
    --kz-switch-off: rgba(255, 255, 255, 0.16);
    --kz-switch-ink: #f2f2f0;
    --kz-switch-thumb: #0a0a0a;
  }
}
```

A site with its own theme switch puts the same rules under its dark selector instead (`[data-theme="dark"] .kodza-switch { … }`); a single dark section, under that section's class.

## Use it

### Plain HTML page

- CSS: `kodza/kodza-switch-toggle.css` next to the page (the Files commands as they are), linked in `<head>`: `<link rel="stylesheet" href="kodza/kodza-switch-toggle.css">`. Without a shell, paste it in a `<style>` in `<head>` instead. It only touches `kodza-` classes.
- HTML: where the component goes. Paste it as many times as you need: instances never interfere.
- No JS.
- Restyle with the `--kz-…` variables, set on the component's root element itself (the root declares its own defaults, so a value on an ancestor is ignored), and with the modifiers / attributes listed under API.
- Font: it takes the page's own. The Kodza look is Geist: `<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap">`.

### Claude artifact (claude.ai)

- Paste the CSS in a `<style>`, in the artifact itself: it loads stylesheets only from Google Fonts and scripts only from a few CDNs, so no `<link>` or `<script src>` to Kodza.
- Writing the artifact file with a shell? Insert the downloaded files (Files) with a command instead of retyping them: a line `KODZA-CSS` alone inside the `<style>`, then `sed -e '/^KODZA-CSS$/{r kodza/kodza-switch-toggle.css' -e 'd' -e '}' page.html > artifact.html`.
- Font: load Geist from Google Fonts (allowed): `<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap">`.
- Dark mode: the viewer sets `data-theme="dark"` or `"light"` on `<html>`, or nothing when it follows the system. Write the Dark mode rules twice: inside `@media (prefers-color-scheme: dark)` with `:root:not([data-theme="light"])` in front of each selector, and with `:root[data-theme="dark"]` in front of each selector.
- Forms: there is nowhere to send them. Handle `submit` in your script with `event.preventDefault()` and show the result in the page.

### WordPress

- HTML: a **Custom HTML** block (or a pattern / template part). WordPress keeps this markup as it is only for users allowed to post unfiltered HTML (Administrators; Super Admins on multisite): for anyone else it strips tags such as `<svg>`, `<input>` or `<dialog>`, so add it from the theme (a pattern or template part) instead.
- This one is inline (it flows like a word): pasted alone, many themes leave it at the edge of the page (block themes, and classic ones like Twenty Twenty-One or Blocksy), so put the Custom HTML block inside a **Group** block to line it up with the text.
- CSS: the downloaded file goes in the theme, under `wp-content/themes/<your-theme>/kodza/` (the child theme if there is one), enqueued from its functions.php (or a code-snippets plugin):
  ```php
  add_action('wp_enqueue_scripts', function () {
    $dir = get_stylesheet_directory() . '/kodza/';
    $uri = get_stylesheet_directory_uri() . '/kodza/';
    wp_enqueue_style('kodza-switch-toggle', $uri . 'kodza-switch-toggle.css', [], filemtime($dir . 'kodza-switch-toggle.css'));
  });
  ```
  Scoped to `kodza-` classes, the CSS never touches the theme.
- No access to the theme files? The CSS can also go, as it is, in **Appearance → Customize → Additional CSS** (classic theme) or **Styles → Additional CSS** in the Site Editor (block theme).
- No JS.
- Colours: by default, match the theme's palette. After the component's CSS, point these variables at the theme's colours, on the component root, Kodza's value as the fallback:
  `.kodza-switch { --kz-switch-fg: var(TEXT, #0a0a0a); --kz-switch-bg: var(BACKGROUND, #ffffff); --kz-switch-ink: var(ACCENT, #0a0a0a); }`
  TEXT, BACKGROUND and ACCENT (the colour the theme fills its own buttons with) are the theme's own colour variables — block themes (theme.json, like Twenty Twenty-Five): `--wp--preset--color--contrast`, `--wp--preset--color--base`, `--wp--preset--color--contrast` (they fill their buttons with it; their accent-1… colours are decorative); Astra: `--ast-global-color-2`, `--ast-global-color-4`, `--ast-global-color-0`; Kadence: `--global-palette3`, `--global-palette9`, `--global-palette1`; GeneratePress: `--contrast`, `--base-3`, `--accent`; Blocksy: `--theme-palette-color-4`, `--theme-palette-color-8`, `--theme-palette-color-1`. Use only these names, and only if the site really has them (the theme's CSS, or Styles → Colors): the `--wp--preset--color--black`, `--white`, `--vivid-…` that WordPress adds everywhere are not the theme's palette. Another theme, or one without these variables (Hello Elementor, OceanWP): leave the variables alone, it keeps Kodza's monochrome; same when the developer asks for monochrome or the Kodza look. Leave the translucent greys (`rgba(10, 10, 10, …)`) as they are: they suit any light background. On a dark palette, set the other variables from Dark mode too.
- WordPress turns straight quotes and `--` into typographic ones in the text of a Custom HTML block (not inside `<code>` or `<pre>`).

#### With Elementor

- HTML: an **HTML** widget (Elementor shows it to administrators only). It keeps the code exactly as pasted, straight quotes included.
- CSS: as above. Elementor's Site Settings → Theme Style styles every button, field, link and image of the page, components included; the theme guard at the end of the CSS keeps the component's buttons, fields and link colours as they are.
- No child theme: the CSS can go in the HTML widget instead, in a `<style>` before the HTML.

### Shopify

- Files: `assets/kodza-switch-toggle.css` (the Files commands with `-o assets/…`).
- In the section: `{{ 'kodza-switch-toggle.css' | asset_url | stylesheet_tag }}`, then the HTML.

### React / Next.js

- Files, side by side (e.g. in `components/kodza/`): `Switch.tsx` (below), the CSS block under Code saved as `switch-toggle.css`, both as they are. The HTML block is already inside the component: skip it.
- Use it: `import { Switch } from '@/components/kodza/Switch';` then `<Switch />`. Props: `variant` ("inline", "labels", or several in an array), `vars` (the `--kz-…` variables listed under API, e.g. `vars={{ '--kz-switch-bg': … }}`), `className`, `style` and the other props of its `<div>` (`onClick`, `aria-…`).
- Next.js App Router: it is a Client Component already (`'use client'`). Pages Router: Next.js takes global CSS only in `pages/_app`, so move the `import './switch-toggle.css'` line there.

```tsx
'use client';
// Kodza — Switch, for React. From https://kodza.dev/components/switch-toggle/
// Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license
// Next to this file: switch-toggle.css, the component's CSS from Kodza, as they are.
// Yours to edit: the markup is plain JSX below.
import { useRef, type ComponentPropsWithoutRef, type ComponentRef, type CSSProperties } from 'react';
import './switch-toggle.css';

type Variant = "inline" | "labels";

export type SwitchProps = Omit<ComponentPropsWithoutRef<'div'>, "children" | "variant" | "vars"> & {
  /** Modifier class(es): .kodza-switch--inline, .kodza-switch--labels */
  variant?: Variant | Variant[];
  /** Settings, as CSS variables on the root */
  vars?: {
    /** default: #ffffff */
    "--kz-switch-bg"?: string | number;
    /** default: #0a0a0a */
    "--kz-switch-fg"?: string | number;
    /** default: rgba(10, 10, 10, 0.6) */
    "--kz-switch-muted"?: string | number;
    /** default: rgba(10, 10, 10, 0.14) */
    "--kz-switch-off"?: string | number;
    /** default: #0a0a0a */
    "--kz-switch-ink"?: string | number;
    /** default: #ffffff */
    "--kz-switch-thumb"?: string | number;
    /** default: 44px */
    "--kz-switch-width"?: string | number;
    /** default: 26px */
    "--kz-switch-height"?: string | number;
    /** default: 3px */
    "--kz-switch-gap"?: string | number;
    /** default: cubic-bezier(0.22, 1, 0.36, 1) */
    "--kz-switch-ease"?: string | number;
    /** default: cubic-bezier(0.34, 1.4, 0.64, 1) */
    "--kz-switch-spring"?: string | number;
  };
  className?: string;
};

export function Switch({ variant, vars, className, style, ...rest }: SwitchProps) {
  const ref = useRef<ComponentRef<'div'>>(null);
  const classes = ["kodza-switch", ...([] as string[]).concat(variant ?? []).map((v) => `kodza-switch--${v}`), className].filter(Boolean).join(' ');
  // Everything the markup is made of: when it changes, React gets a fresh element (see the top)
  const key = JSON.stringify([classes, vars, style, rest]);

  return (
    <div key={key} {...rest} className={classes} style={{ ...vars, ...style } as CSSProperties} ref={ref}>
      <label className="kodza-switch__row">
        <span className="kodza-switch__text">Dark mode<small>Easier on the eyes at 2 a.m.</small></span>
        {' '}
        <input className="kodza-switch__input" type="checkbox" role="switch" defaultChecked />
        {' '}
        <span className="kodza-switch__track" aria-hidden="true">
          <span className="kodza-switch__thumb" />
        </span>
      </label>
      {' '}
      <label className="kodza-switch__row">
        <span className="kodza-switch__text">Email me when it ships<small>One email per release. We promise.</small></span>
        {' '}
        <input className="kodza-switch__input" type="checkbox" role="switch" />
        {' '}
        <span className="kodza-switch__track" aria-hidden="true">
          <span className="kodza-switch__thumb" />
        </span>
      </label>
      {' '}
      <label className="kodza-switch__row">
        <span className="kodza-switch__text">Deploy on Fridays<small>Not on our watch.</small></span>
        {' '}
        <input className="kodza-switch__input" type="checkbox" role="switch" disabled />
        {' '}
        <span className="kodza-switch__track" aria-hidden="true">
          <span className="kodza-switch__thumb" />
        </span>
      </label>
    </div>
  );
}
```

## Code

```html
<div class="kodza-switch">
  <label class="kodza-switch__row">
    <span class="kodza-switch__text">Dark mode<small>Easier on the eyes at 2 a.m.</small></span>
    <input class="kodza-switch__input" type="checkbox" role="switch" checked>
    <span class="kodza-switch__track" aria-hidden="true"><span class="kodza-switch__thumb"></span></span>
  </label>
  <label class="kodza-switch__row">
    <span class="kodza-switch__text">Email me when it ships<small>One email per release. We promise.</small></span>
    <input class="kodza-switch__input" type="checkbox" role="switch">
    <span class="kodza-switch__track" aria-hidden="true"><span class="kodza-switch__thumb"></span></span>
  </label>
  <label class="kodza-switch__row">
    <span class="kodza-switch__text">Deploy on Fridays<small>Not on our watch.</small></span>
    <input class="kodza-switch__input" type="checkbox" role="switch" disabled>
    <span class="kodza-switch__track" aria-hidden="true"><span class="kodza-switch__thumb"></span></span>
  </label>
</div>

<div class="kodza-switch kodza-switch--labels">
  <label class="kodza-switch__row">
    <span class="kodza-switch__text">Autosave<small>Your work, saved before you think of it.</small></span>
    <input class="kodza-switch__input" type="checkbox" role="switch" checked>
    <span class="kodza-switch__track" aria-hidden="true"><span class="kodza-switch__words"><span>On</span><span>Off</span></span><span class="kodza-switch__thumb"></span></span>
  </label>
</div>

<div class="kodza-switch kodza-switch--inline">
  <label class="kodza-switch__row">
    <span class="kodza-switch__text">No JavaScript<small>12</small></span>
    <input class="kodza-switch__input" type="checkbox" role="switch">
    <span class="kodza-switch__track" aria-hidden="true"><span class="kodza-switch__thumb"></span></span>
  </label>
</div>
```

```css
/* Kodza License: free to use, client work included. Not to resell or redistribute, ported or not: https://kodza.dev/docs/#print-license */
/* Kodza — Switch
   A real checkbox (role="switch"), redrawn: the ink fills the track from the thumb's side as
   it slides, the thumb stretches while you press it (like a finger squashing it) and springs
   into place. With --labels, "On" and "Off" roll inside the track. Laid out as settings rows;
   --inline puts one in a toolbar, label then switch on one line (the small text becomes a count).
   Everything is tuned with the --kz-switch-* variables. */
.kodza-switch {
  --kz-switch-bg: #ffffff;
  --kz-switch-fg: #0a0a0a;
  --kz-switch-muted: rgba(10, 10, 10, 0.6);
  --kz-switch-off: rgba(10, 10, 10, 0.14);
  --kz-switch-ink: #0a0a0a;
  --kz-switch-thumb: #ffffff;
  --kz-switch-width: 44px;
  --kz-switch-height: 26px;
  --kz-switch-gap: 3px;
  --kz-switch-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --kz-switch-spring: cubic-bezier(0.34, 1.4, 0.64, 1);

  display: grid;
  width: 100%;
  max-width: 440px;
  color: var(--kz-switch-fg);
}

.kodza-switch__row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  cursor: pointer;
}

.kodza-switch__row + .kodza-switch__row {
  border-top: 1px solid var(--kz-switch-off);
}

.kodza-switch__text {
  display: grid;
  gap: 2px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.25;
}

.kodza-switch__text small {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--kz-switch-muted);
}

/* The real checkbox stays, invisible, over the track */
.kodza-switch__input {
  position: absolute;
  top: 50%;
  right: 0;
  width: var(--kz-switch-width);
  height: var(--kz-switch-height);
  margin: 0;
  opacity: 0;
  cursor: inherit;
  transform: translateY(-50%);
}

.kodza-switch__track {
  position: relative;
  flex: none;
  width: var(--kz-switch-width);
  height: var(--kz-switch-height);
  overflow: hidden;
  border-radius: 999px;
  background: var(--kz-switch-off);
  isolation: isolate;
}

/* The ink fills from the left, following the thumb */
.kodza-switch__track::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--kz-switch-ink);
  clip-path: inset(0 calc(100% - var(--kz-switch-height)) 0 0 round 999px);
  opacity: 0;
  transition: clip-path 0.4s var(--kz-switch-ease), opacity 0.2s ease 0.15s;
}

.kodza-switch__input:checked + .kodza-switch__track::before {
  clip-path: inset(0 0 0 0 round 999px);
  opacity: 1;
  transition: clip-path 0.45s var(--kz-switch-ease), opacity 0.1s ease;
}

.kodza-switch__thumb {
  position: absolute;
  top: var(--kz-switch-gap);
  left: var(--kz-switch-gap);
  width: calc(var(--kz-switch-height) - var(--kz-switch-gap) * 2);
  height: calc(var(--kz-switch-height) - var(--kz-switch-gap) * 2);
  border-radius: 999px;
  background: var(--kz-switch-thumb);
  box-shadow: 0 1px 3px rgba(10, 10, 10, 0.25);
  transform-origin: left center;
  transition: transform 0.45s var(--kz-switch-spring), scale 0.25s var(--kz-switch-ease);
}

.kodza-switch__input:checked + .kodza-switch__track .kodza-switch__thumb {
  transform: translateX(calc(var(--kz-switch-width) - var(--kz-switch-height)));
  transform-origin: right center;
}

/* Pressed: the thumb stretches towards where it is going */
.kodza-switch__row:active .kodza-switch__thumb {
  scale: 1.3 1;
}

.kodza-switch__input:focus-visible + .kodza-switch__track {
  outline: 2px solid var(--kz-switch-fg);
  outline-offset: 3px;
}

/* --labels: a wider track where "On" and "Off" roll */
.kodza-switch--labels {
  --kz-switch-width: 64px;
  --kz-switch-height: 30px;
}

.kodza-switch__words {
  position: absolute;
  inset: 0;
  display: grid;
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.kodza-switch__words span {
  grid-area: 1 / 1;
  align-self: center;
  transition: transform 0.4s var(--kz-switch-ease);
}

.kodza-switch__words span:first-child {
  justify-self: start;
  padding-left: 10px;
  color: var(--kz-switch-thumb);
  transform: translateY(-160%);
}

.kodza-switch__words span:last-child {
  justify-self: end;
  padding-right: 9px;
  color: var(--kz-switch-muted);
}

.kodza-switch__input:checked + .kodza-switch__track .kodza-switch__words span:first-child {
  transform: none;
  transition-delay: 0.1s;
}

.kodza-switch__input:checked + .kodza-switch__track .kodza-switch__words span:last-child {
  transform: translateY(160%);
}

/* --inline: one switch in a toolbar or a filter bar, sized to its words */
.kodza-switch--inline {
  display: inline-grid;
  width: auto;
  max-width: 100%;
  vertical-align: middle;
}

.kodza-switch--inline .kodza-switch__row {
  justify-content: flex-start;
  gap: 10px;
  min-height: 40px;
  padding: 0;
}

.kodza-switch--inline .kodza-switch__text {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 14px;
  white-space: nowrap;
}

.kodza-switch--inline .kodza-switch__text small {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

/* Disabled */
.kodza-switch__row:has(.kodza-switch__input:disabled) {
  cursor: not-allowed;
}

.kodza-switch__row:has(.kodza-switch__input:disabled) .kodza-switch__track,
.kodza-switch__row:has(.kodza-switch__input:disabled) .kodza-switch__text {
  opacity: 0.45;
}

@media (prefers-reduced-motion: reduce) {
  .kodza-switch__track::before,
  .kodza-switch__thumb,
  .kodza-switch__words span {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* Theming example — on a dark background:
.dark-section .kodza-switch {
  --kz-switch-bg: #161616;
  --kz-switch-fg: #f2f2f0;
  --kz-switch-muted: rgba(242, 242, 240, 0.62);
  --kz-switch-off: rgba(255, 255, 255, 0.16);
  --kz-switch-ink: #f2f2f0;
  --kz-switch-thumb: #0a0a0a;
}
*/

/* kodza-guard 7928509c471a — generated by Kodza, do not edit.
   Theme guard: keeps a site's own CSS (WordPress themes, Bootstrap, CSS resets…) off this
   component. :not(#_) is always true and weighs as much as an id, so these lines win over
   theme rules made of classes and tags. Customise the component through its --kz-* variables. */

/* What the browser gives, where the component sets it only in some states: at the lowest weight, so its own rules below put it back */

:where(.kodza-switch__row):not(#_) {
  border-top-width: revert;
  border-top-style: revert;
  border-top-color: revert;
}

/* What the browser gives, on everything the component leaves to it */

.kodza-switch:not(#_),
.kodza-switch__text:not(#_),
.kodza-switch__track:not(#_),
.kodza-switch__thumb:not(#_),
.kodza-switch__words:not(#_),
.kodza-switch__words span:where(:not([class*="kodza-"])):not(#_) {
  box-sizing: revert;
}

.kodza-switch__row:not(#_) {
  margin: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  border-right-width: revert;
  border-bottom-width: revert;
  border-left-width: revert;
  border-right-style: revert;
  border-bottom-style: revert;
  border-left-style: revert;
  border-right-color: revert;
  border-bottom-color: revert;
  border-left-color: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-switch__input:not(#_) {
  border: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  color: revert;
  font-family: revert;
  font-size: revert;
  font-weight: revert;
  font-style: revert;
  line-height: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
  white-space: revert;
  min-height: revert;
}

.kodza-switch__text small:where(:not([class*="kodza-"])):not(#_) {
  border: revert;
  margin: revert;
  padding: revert;
  border-radius: revert;
  outline: revert;
  text-decoration: revert;
  transition: revert;
  list-style: revert;
  box-sizing: revert;
  float: revert;
  position: revert;
  background-color: revert;
  background-image: revert;
  box-shadow: revert;
  outline-offset: revert;
  appearance: revert;
  max-width: revert;
  max-height: revert;
  font-family: revert;
  font-style: revert;
  letter-spacing: revert;
  text-transform: revert;
  text-underline-offset: revert;
  text-align: revert;
  text-indent: revert;
  text-shadow: revert;
  vertical-align: revert;
}

.kodza-switch__input:not(#_):where(:not([hidden])),
.kodza-switch__text small:where(:not([class*="kodza-"])):not(#_):where(:not([hidden])) {
  display: revert;
}

.kodza-switch__input:not(#_):where([hidden]),
.kodza-switch__text small:where(:not([class*="kodza-"])):not(#_):where([hidden]) {
  display: none;
}

.kodza-switch__track:not(#_)::before {
  box-sizing: revert;
}

/* The component's own rules, one step stronger: real buttons and fields, what it sets on tags themes style (links, lists, headings, images…), and the root width (a theme may narrow it, never widen it) */

.kodza-switch:not(#_) {
  width: min(100%, 440px);
}

.kodza-switch__row:not(#_) {
  position: relative;
  display: flex;
  padding: 14px 0;
}

.kodza-switch__row + .kodza-switch__row:not(#_) {
  border-top: 1px solid var(--kz-switch-off);
}

.kodza-switch__text small:not(#_) {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--kz-switch-muted);
}

.kodza-switch__input:not(#_) {
  position: absolute;
  top: 50%;
  right: 0;
  width: var(--kz-switch-width);
  height: var(--kz-switch-height);
  margin: 0;
  opacity: 0;
  cursor: inherit;
  transform: translateY(-50%);
}

.kodza-switch--inline:not(#_) {
  width: auto;
}

.kodza-switch--inline .kodza-switch__row:not(#_) {
  padding: 0;
}

.kodza-switch--inline .kodza-switch__text small:not(#_) {
  font-size: 12.5px;
  line-height: 1.25;
}
```

Free to use, from Kodza (https://kodza.dev).
