Skip to content

Commit 3af1cad

Browse files
committed
pass scope to new checkbox parts
1 parent 9261ea6 commit 3af1cad

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

packages/react/checkbox/src/checkbox.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,18 @@ const Checkbox = React.forwardRef<CheckboxElement, CheckboxProps>(
228228
// @ts-expect-error
229229
internal_do_not_use_render={({ isFormControl }: CheckboxContextValue) => (
230230
<>
231-
<CheckboxTrigger {...checkboxProps} ref={forwardedRef} />
232-
{isFormControl && <CheckboxBubbleInput />}
231+
<CheckboxTrigger
232+
{...checkboxProps}
233+
ref={forwardedRef}
234+
// @ts-expect-error
235+
__scopeCheckbox={__scopeCheckbox}
236+
/>
237+
{isFormControl && (
238+
<CheckboxBubbleInput
239+
// @ts-expect-error
240+
__scopeCheckbox={__scopeCheckbox}
241+
/>
242+
)}
233243
</>
234244
)}
235245
/>
@@ -287,14 +297,7 @@ type InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;
287297
interface CheckboxBubbleInputProps extends Omit<InputProps, 'checked'> {}
288298

289299
const CheckboxBubbleInput = React.forwardRef<HTMLInputElement, CheckboxBubbleInputProps>(
290-
(
291-
{
292-
__scopeCheckbox,
293-
294-
...props
295-
}: ScopedProps<CheckboxBubbleInputProps>,
296-
forwardedRef
297-
) => {
300+
({ __scopeCheckbox, ...props }: ScopedProps<CheckboxBubbleInputProps>, forwardedRef) => {
298301
const {
299302
control,
300303
hasConsumerStoppedPropagationRef,

0 commit comments

Comments
 (0)