Skip to main content

Switch

MSK Switch는 단일 on/off 설정을 제어하는 primitive입니다. 체크박스보다 명시적인 설정 토글에 사용합니다.

Preview

공개 기능 활성

Data API

<button type="button" data-msk-switch aria-checked="false">
알림
</button>

JavaScript API

window.MSK.ui.switch.set(button, true);
window.MSK.ui.switch.toggle(button);

Events

button.addEventListener('msk:switch-change', (event) => {
console.log(event.detail.checked);
});

Switch는 role="switch", aria-checked, data-state를 동기화합니다.