feat: add ariaLabel prop to Switch component (#25230)
This commit is contained in:
1 file changed
+3
-1
@@ -8,6 +8,7 @@
|
|||||||
export let state = true;
|
export let state = true;
|
||||||
export let id = '';
|
export let id = '';
|
||||||
export let ariaLabelledbyId = '';
|
export let ariaLabelledbyId = '';
|
||||||
|
export let ariaLabel = '';
|
||||||
export let tooltip = false;
|
export let tooltip = false;
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
@@ -27,7 +28,8 @@
|
|||||||
<Switch.Root
|
<Switch.Root
|
||||||
bind:checked={state}
|
bind:checked={state}
|
||||||
{id}
|
{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 ??
|
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)
|
false)
|
||||||
? 'focus:outline focus:outline-2 focus:outline-gray-800 focus:dark:outline-gray-200'
|
? 'focus:outline focus:outline-2 focus:outline-gray-800 focus:dark:outline-gray-200'
|
||||||
|
|||||||
Reference in new issue
Block a user