We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b9cf71 commit 03222c2Copy full SHA for 03222c2
packages/pluggableWidgets/combobox-web/src/hooks/useHasLabel.ts
@@ -0,0 +1,13 @@
1
+import { useEffect, useState } from "react";
2
+
3
+export function useHasLabel(inputId: string): boolean {
4
+ const [hasLabel, setHasLabel] = useState(false);
5
6
+ useEffect(() => {
7
+ const label = document.querySelector(`label[for="${inputId}"]`);
8
9
+ setHasLabel(!!label);
10
+ }, [inputId]);
11
12
+ return hasLabel;
13
+}
0 commit comments