ButtonGroup

A compact set of mutually exclusive icon-only toggle buttons. Exactly one button is active at a time (radio behaviour). Ideal for toolbars, sort controls, and view-mode switchers. Each button shows a tooltip on hover. Fires m:buttongroup:change when the selection changes.

Sort Controls

Date and alphabetical sort — one active at a time.

Click a sort button…

View Mode

Switch between list, grouped, and grid layouts.

Click a view button…

Combined Toolbar

Multiple groups with a visual separator, wrapped in an .m-toolbar container.

Interact with the toolbar…

Programmatic Control

 
Active value will appear here…
PHP

PHP PHP Methods (Fluent)

Method / PropertyParametersDescription
$m->buttonGroup($id)Create a ButtonGroup instance.
->buttons($arr)arrayDefine the buttons. Each item: {value, icon, tooltip?, active?}.
->addClass($class)stringAdd extra CSS classes to the group element.
->attr($name, $val)string, stringSet an arbitrary HTML attribute on the group element.

JS JS Methods

Method / PropertyParametersDescription
m.buttonGroup(id)string|HTMLElementGet (or initialise) a ButtonGroup instance.
.getActive()Return the currently active value, or null if none.
.setActive(value)stringProgrammatically activate a button by value; fires the change event if the value differs.

EVENT Events

Event NameDetailDescription
m:buttongroup:change{ value: string }Fired on the group element whenever the active button changes.