Skip to content

Swap

An icon toggle that swaps between two states with a small rotation, menu/close, play/pause, sun/moon.

Swaps

Installation

Everything ships in one stylesheet. There is nothing to import per component.

<link rel="stylesheet" href="https://mian.ro/dist/mian.css">

Prefer to own the files? /r/swap.json is a registry item with this component's CSS and example markup, ready to copy into your project with any tool that reads the open registry-item format.

Class reference

Class / attributeDescription
mn-swapA label with a checkbox inside.
mn-swap-on · mn-swap-offContent for the checked and unchecked states.
mn-swap-flipFlip instead of rotate.

Accessibility

  • The checkbox carries the name (aria-label) and the state; screen readers announce it as a checkbox.
  • For a toggle that is not a setting (e.g. opening a menu), use a button with aria-expanded instead.
Choose a noodle

Minimal

Flat

Pixel

Linear

Thin

Glass

Textured

Bold

Elegant

Rounded

On this page