feat: add ariaLabel prop to Switch component (#25230)

This commit is contained in:
maco
2026-06-29 10:15:11 +02:00
committed by GitHub
parent 390e200f76
commit 958fdbdc88

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'