Skip to content

Favorite Toggle ​

A chrome-less star button that toggles a favorite on or off. Unlike icon_button it carries no hover plate; state shows through the glyph alone — outline star at rest, filled amber when on.

Examples ​

Basic usage ​

moonbit
@sumi.favorite_toggle(checked=fav, on_change=set_fav.map(v => _ => v))
@sumi.favorite_toggle(checked=true, disabled=true)

API ​

favorite_toggle ​

NameTypeDefaultDescription
checked *Bool—Current on/off state (controlled)
on_changeEmit[Bool]—Emitted with the flipped value on click
disabledBoolfalseFaded and inert
aria_labelString—Override the accessible label (defaults flip with state)
idString—Element id
classString—Extra class names
attrsAttrs—Extra HTML attributes
styleArray[String][]Extra inline styles

* required (labelled) parameter — everything else is optional.