Skip to content

Commit 2635f4e

Browse files
committed
feat: Allow jsx children as label in 'Checkbox' component
1 parent cb47c33 commit 2635f4e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

features/@app-core/forms/Checkbox.styled.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export const CheckboxProps = schema('CheckboxProps', {
1919
hitSlop: z.number().default(6),
2020
})
2121

22-
export type CheckboxProps = PropsOf<typeof CheckboxRoot, typeof CheckboxProps>
22+
export type CheckboxProps = PropsOf<typeof CheckboxRoot, typeof CheckboxProps> & {
23+
children?: React.ReactNode
24+
}
2325

2426
/* --- <Checkbox/> ----------------------------------------------------------------------------- */
2527

@@ -30,7 +32,8 @@ export const Checkbox = forwardRef<
3032

3133
// Props
3234
const props = CheckboxProps.applyDefaults(rawProps)
33-
const { checked, disabled, label, hasError, onCheckedChange } = props
35+
const { checked, disabled, hasError, onCheckedChange } = props
36+
const label = props.label || props.children
3437

3538
// Vars
3639
const nativeID = props.id || props.nativeID

0 commit comments

Comments
 (0)