diff --git a/components/src/Switcher/Switcher.stories.svelte b/components/src/Switcher/Switcher.stories.svelte
index 622e19a..b4f366b 100644
--- a/components/src/Switcher/Switcher.stories.svelte
+++ b/components/src/Switcher/Switcher.stories.svelte
@@ -12,13 +12,7 @@
-
+
@@ -41,7 +35,6 @@
interface SwitcherProps {
/**
- * Human-readable label for the input.
+ * Human-readable label
*/
label: string;
- options: string[];
/**
- * Machine-readable name for the input. Should be unique across the document.
+ * Available options
*/
- groupName: string;
+ options: string[];
/**
- * Type size
+ * Display size
*/
size?: 'default' | 'small';
/**
@@ -19,18 +18,12 @@
value: string | null;
}
- let {
- label,
- options,
- groupName,
- size = 'default',
- value = $bindable(null)
- }: SwitcherProps = $props();
+ let { label, options, size = 'default', value = $bindable(null) }: SwitcherProps = $props();
+
+ const groupId = $props.id();
+ const groupName = 'select-' + groupId;
function optionToID(o: string) {
- // TODO: This should use $id() when it comes out, so
- // input IDs are guaranteed unique across the app
- // See: https://github.com/sveltejs/svelte/issues/13108
return `${groupName}-option-${o.replace(/ /g, '-').toLowerCase()}`;
}
@@ -42,12 +35,6 @@
@@ -56,6 +43,8 @@