Magoo Component UI logo Magoo Component UI
← Catalog

Light Control

light-control molecule experimental

A dimmable smart-light tile with a power switch, a brightness slider, and an optional colour swatch.

Also in: Cards

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
Living room
70%
Off
Bedroom lamp
20%

Props

NameTypeReq
name string ✓
on boolean
brightness_pct integer
color_hex string

Related components

How to use

Layout is static and renders with no JavaScript, so the switch position, slider fill and readout reflect the on and brightness_pct props at render time. behavior.js wires interaction: clicking the switch flips data-state on the button and knob (and aria-checked), and dragging the range input updates the fill width and the percentage; both dispatch a bubbling "light:change" event carrying the current on/brightness. The portable self-init reads state from the DOM and passes no props.

Use cases

cardcontrol WCAG AA SEO 20 dir: both ai-generated