Magoo Component UI logo Magoo Component UI
← Catalog

Vote Control

vote-control molecule experimental

A stacked up/down arrow control with a score between them, highlighting the active vote and toggling off on re-click.

The width preview needs a screen wider than the chosen width — use a larger device (or a desktop browser) to see the desktop and tablet layouts.

Default
128
Upvoted
129

Props

NameTypeReq
score string ✓
vote enum ( | up | down)

Related components

How to use

The active highlight is driven by the root's data-vote attribute through group-data variants, so the up and down states render in screenshots with no JavaScript. behavior.js sets or clears data-vote on click (re-clicking the active arrow toggles it back to neutral), keeps aria-pressed in sync on both buttons, and dispatches a bubbling "vote:change" CustomEvent with { vote }. The score is display-only here; update it from the event in the parent.

Use cases

highlight WCAG AA SEO 10 dir: both ai-generated