Skip to content

Commit 46a5c7b

Browse files
authored
fix(CheckBoxField): pass required prop down to Checkbox (#6274)
* fix(CheckBoxField): pass required prop down to Checkbox Signed-off-by: Emmanuel CHAMBON <echambon@scaleway.com> * chore: add changeset Signed-off-by: Emmanuel CHAMBON <echambon@scaleway.com> * chore: update snaps Signed-off-by: Emmanuel CHAMBON <echambon@scaleway.com> --------- Signed-off-by: Emmanuel CHAMBON <echambon@scaleway.com>
1 parent d52e5bb commit 46a5c7b

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

.changeset/three-foxes-attack.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ultraviolet/form": patch
3+
---
4+
5+
pass required prop down to Checkbox

packages/form/src/components/CheckboxField/__tests__/__snapshots__/index.test.tsx.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ exports[`checkboxField > should render correctly with errors 1`] = `
325325
class="uv_9pjq8o5 uv_9pjq8o4"
326326
id="_r_d_"
327327
name="test"
328+
required=""
328329
type="checkbox"
329330
/>
330331
<svg
@@ -372,6 +373,11 @@ exports[`checkboxField > should render correctly with errors 1`] = `
372373
>
373374
Checkbox field error
374375
</label>
376+
<sup
377+
class="uv_m4c9ow0 uv_m4c9ow4 uv_m4c9ow9 uv_m4c9owj uv_m4c9ow1a uv_m4c9ow2m"
378+
>
379+
*
380+
</sup>
375381
</div>
376382
<span
377383
class="uv_9pjq8o0 uv_m4c9ow0 uv_m4c9ow4 uv_m4c9ow9 uv_m4c9owp uv_m4c9ow1a uv_m4c9ow2m"

packages/form/src/components/CheckboxField/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export const CheckboxField = <
5353
return (
5454
<Checkbox
5555
{...props}
56+
required={required}
5657
checked={!!field.value}
5758
disabled={field.disabled}
5859
error={getError({ label: label ?? ariaLabel ?? name }, error)}

0 commit comments

Comments
 (0)