Corpora UI
Atoms

Switch

A boolean setting that takes effect immediately.

Usage

Import the stylesheet once at the application root: @exegia/corpora-ui/index.css.

import { Switch } from "@exegia/corpora-ui/ui/switch"

function ComponentPreview({ disabled }: { disabled: boolean }) {

  return (
    <div className="relative mx-auto w-full max-w-lg p-6">
      <label className="flex items-center gap-3"><Switch disabled={disabled} defaultChecked />Show annotations</label>
    </div>
  )
}

<ComponentPreview {...{ disabled: false }} />

API notes

checked and onCheckedChange control state; defaultChecked initializes it. disabled prevents interaction. Always supply a visible label.

Last updated on

On this page