Smear Orb Switch

An on/off switch whose knob smears and bursts as it moves, with an ON/OFF badge.

  • <kt-smear-switch>
  • Inputs
  • No framework

Smear Orb Switch

The code

Copy the Smear Orb Switch

Fastest: press Copy on the card above for one complete file. To build it into your own project, use the files below: the markup, the styles, this component’s script and the shared effects script (effects.js) that every component uses.

<kt-smear-switch checked label="Kinetic Engine" sfx="シュッ!"></kt-smear-switch>

<kt-smear-switch label="Strict Mode" sfx="カチッ!"></kt-smear-switch>

Attributes

NameWhat it doesDefault
checkedPresent when the switch is on.—
labelText beside the switch.Switch
sfxSound-effect text on toggle.カチッ!

Keyboard and screen readers

  • role="switch" with aria-checked.
  • Space or Enter toggles; the label is clickable.

Styling variables

Every look is a CSS variable: --kt-accent, --kt-accent-ink, --kt-radius-btn, --kt-surface-radius, --kt-surface-bg, --kt-border-w, --kt-comp-shadow and --font-sans. The copied file sets them all from your choices.

FAQ

Smear Orb Switch: questions answered

How do I use the Smear Orb Switch?

Press Copy on the card to get a complete HTML file, or copy the HTML, CSS and JavaScript tabs into your own page. In your markup the element is written as <kt-smear-switch>.

Which attributes does <kt-smear-switch> accept?

checked, label, sfx. Each one is described in the attributes table on this page.

Is the Smear Orb Switch accessible?

role="switch" with aria-checked. Space or Enter toggles; the label is clickable.

Can I change the Smear Orb Switch colors, corners and font?

Yes. Use the options on this page: accent color, border radius, background, border, shadow and Google font. The copied code already contains your choices, and every one of them is a CSS variable you can edit later.