Skip to content

Toggle group

A set of pressable buttons, single choice like a segmented control, or multiple like a formatting toolbar.

CSS + mian.js JSON Markdown Registry item

Single choice

Multiple

As a form field (no JS)

Installation

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

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

Prefer to own the files? /r/toggle-group.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-toggle-groupContainer.
data-mn-toggle="single | multiple"Button mode, handled by mian.js.
mn-toggle-group-blockStretches to full width.

Accessibility

  • Button mode sets aria-pressed on each button; arrow keys move between them.
  • For a form value with no JavaScript, use the label + radio version: it submits with the form and is announced as a radio group.
Choose a noodle

Minimal

Flat

Pixel

Linear

Thin

Glass

Textured

Bold

Elegant

Rounded

On this page