Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit c9251fe

Browse files
committed
fix(checkbox): computed id
Signed-off-by: Zakaria Sahmane <[email protected]>
1 parent 61e19bd commit c9251fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/c-checkbox/src/checkbox.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ export const CCheckbox = defineComponent({
179179
mergedProps as CFormControlProviderContext
180180
)
181181

182-
const id = props.id || useId().value
182+
const id = useId(props.id)
183183
const [rootId, inputId, controlId, labelId] = useIds(
184-
`chakra-checkbox-${id}`,
184+
`chakra-checkbox-${id.value}`,
185185
"root",
186186
"input",
187187
"control",
@@ -221,7 +221,7 @@ export const CCheckbox = defineComponent({
221221
})
222222

223223
const context = computed<checkbox.Context>(() => ({
224-
id,
224+
id: id.value,
225225
ids: {
226226
root: rootId.value,
227227
input: inputId.value,
@@ -233,7 +233,7 @@ export const CCheckbox = defineComponent({
233233

234234
const [state, send] = useMachine(
235235
// @ts-ignore
236-
checkbox.machine({ id, ...context.value })
236+
checkbox.machine({ ...context.value })
237237
)
238238

239239
const api = computed(() =>

0 commit comments

Comments
 (0)