From 932ba90ac7f541ce79708d7845aea5cb776f02dc Mon Sep 17 00:00:00 2001 From: "Max G." <64729700+max-got@users.noreply.github.com> Date: Mon, 28 Oct 2024 15:42:15 +0100 Subject: [PATCH] feat: add ID Attribute to Toggle Root Component (#823) Co-authored-by: Hunter Johnston <64506580+huntabyte@users.noreply.github.com> --- .changeset/calm-snails-refuse.md | 5 +++++ packages/bits-ui/src/lib/bits/toggle/toggle.svelte.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/calm-snails-refuse.md diff --git a/.changeset/calm-snails-refuse.md b/.changeset/calm-snails-refuse.md new file mode 100644 index 000000000..c40ad486b --- /dev/null +++ b/.changeset/calm-snails-refuse.md @@ -0,0 +1,5 @@ +--- +"bits-ui": patch +--- + +Add ID Attribute to Toggle Root Component diff --git a/packages/bits-ui/src/lib/bits/toggle/toggle.svelte.ts b/packages/bits-ui/src/lib/bits/toggle/toggle.svelte.ts index 638a4eac8..a6bdface0 100644 --- a/packages/bits-ui/src/lib/bits/toggle/toggle.svelte.ts +++ b/packages/bits-ui/src/lib/bits/toggle/toggle.svelte.ts @@ -48,6 +48,7 @@ class ToggleRootState { () => ({ [ROOT_ATTR]: "", + id: this.#id.current, "data-disabled": getDataDisabled(this.#disabled.current), "aria-pressed": getAriaPressed(this.pressed.current), "data-state": getToggleDataState(this.pressed.current),