diff --git a/.changeset/grumpy-suns-watch.md b/.changeset/grumpy-suns-watch.md new file mode 100644 index 00000000..8bf999c2 --- /dev/null +++ b/.changeset/grumpy-suns-watch.md @@ -0,0 +1,5 @@ +--- +'svelte-ux': patch +--- + +fix(TextField/Field): Expose `id` prop diff --git a/packages/svelte-ux/src/lib/components/Field.svelte b/packages/svelte-ux/src/lib/components/Field.svelte index 64a3d814..fcf3ea25 100644 --- a/packages/svelte-ux/src/lib/components/Field.svelte +++ b/packages/svelte-ux/src/lib/components/Field.svelte @@ -53,7 +53,7 @@ $: hasPrepend = $$slots.prepend || icon != null; $: hasAppend = $$slots.append || iconRight != null || clearable || error; - const id = uniqueId('field-'); + export let id = uniqueId('field-'); let labelEl: HTMLLabelElement | null = null; diff --git a/packages/svelte-ux/src/lib/components/TextField.svelte b/packages/svelte-ux/src/lib/components/TextField.svelte index 31bd99b8..bca893a3 100644 --- a/packages/svelte-ux/src/lib/components/TextField.svelte +++ b/packages/svelte-ux/src/lib/components/TextField.svelte @@ -208,7 +208,7 @@ $: hasPrefix = $$slots.prefix || type === 'currency'; $: hasSuffix = $$slots.suffix || type === 'percent'; - const id = uniqueId('textfield-'); + export let id = uniqueId('textfield-'); let labelEl: HTMLLabelElement | null = null;