feat: add ariaLabel prop to Switch component

This commit is contained in:
maco 2026-05-30 23:12:13 +02:00
parent 4923920bf1
commit eba81239af

View file

@ -8,6 +8,7 @@
export let state = true;
export let id = '';
export let ariaLabelledbyId = '';
export let ariaLabel = '';
export let tooltip = false;
const i18n = getContext('i18n');
@ -27,7 +28,8 @@
<Switch.Root
bind:checked={state}
{id}
aria-labelledby={ariaLabelledbyId}
aria-labelledby={ariaLabelledbyId || undefined}
aria-label={ariaLabel || undefined}
class="flex h-[1.125rem] min-h-[1.125rem] w-8 shrink-0 cursor-pointer items-center rounded-full px-1 mx-[1px] transition {($settings?.highContrastMode ??
false)
? 'focus:outline focus:outline-2 focus:outline-gray-800 focus:dark:outline-gray-200'