From c6d122008b62432cf2a9c9394413896064aad528 Mon Sep 17 00:00:00 2001 From: Jeremy Gallant Date: Tue, 22 Apr 2025 23:26:49 +0200 Subject: [PATCH] Unique id --- src/components/UI/Slider.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/UI/Slider.tsx b/src/components/UI/Slider.tsx index 5e692e9a..4c73b39a 100644 --- a/src/components/UI/Slider.tsx +++ b/src/components/UI/Slider.tsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useId, useState } from "react"; import * as SliderPrimitive from "@radix-ui/react-slider"; import { cn } from "@core/utils/cn.ts"; @@ -32,6 +32,7 @@ export function Slider({ const [internalValue, setInternalValue] = useState(value); const isControlled = value !== undefined; const currentValue = isControlled ? value! : internalValue; + const id = useId(); const handleValueChange = (newValue: number[]) => { if (!isControlled) setInternalValue(newValue); @@ -72,7 +73,7 @@ export function Slider({ {currentValue.map((_, i) => (