Any other virtual element properties, including attributes and event handlers.
OptionalanchorBadge positioning relative to child element
Optionalaria-ARIA label for accessibility Automatically generated from badgeContent if not provided
OptionalbadgeAdditional CSS class for badge element (not wrapper)
OptionalbadgeContent to display in badge (number or string) For 'dot' variant, this is ignored
OptionalclassThe class name(s) for this virtual element, as a space-separated list.
OptionalclassAdditional CSS class for wrapper element
OptionalcolorBadge background color from MaterialColor palette
OptionalcolorColor intensity modifier
OptionalinvisibleForce hide badge regardless of badgeContent
OptionalkeyA key to optionally associate with this element.
OptionalmaxMaximum value to display - if badgeContent exceeds this, shows "max+"
OptionaloverlapOverlap mode affecting positioning offset
OptionalshowShow badge even when badgeContent is 0
OptionalvariantBadge display variant
OptionalonbeforeremoveThe onbeforeremove hook is called before a DOM element is detached from the document. If a Promise is returned, Mithril only detaches the DOM element after the promise completes.
OptionalonbeforeupdateThe onbeforeupdate hook is called before a vnode is diffed in a update.
OptionaloncreateThe oncreate hook is called after a DOM element is created and attached to the document.
OptionaloninitThe oninit hook is called before a vnode is touched by the virtual DOM engine.
OptionalonremoveThe onremove hook is called before a DOM element is removed from the document.
OptionalonupdateThe onupdate hook is called after a DOM element is updated, while attached to the document.
Badge component attributes
Displays a badge anchored to a child element, commonly used for notifications, counts, or status indicators.
Example