Adds new Checkbox and CheckboxField components (#37665)

This commit is contained in:
diondiondion authored and GitHub committed 2026-01-30 14:44:28 +00:00
1 parent a75790143c
commit a7a33ef6bc
17 files changed
+344 -50

No files matched your search

@@ -3,9 +3,9 @@ import { forwardRef } from 'react';
import classNames from 'classnames';
import type { CommonFieldWrapperProps } from './form_field_wrapper';
import { FormFieldWrapper } from './form_field_wrapper';
import classes from './toggle.module.css';
import type { CommonFieldWrapperProps } from './wrapper';
import { FormFieldWrapper } from './wrapper';
type Props = Omit<ComponentPropsWithoutRef<'input'>, 'type'> & {
size?: number;
@@ -21,16 +21,15 @@ export const ToggleField = forwardRef<
required={required}
hasError={hasError}
inputId={id}
inputPlacement='inline-end'
>
{(inputProps) => (
<PlainToggleField {...otherProps} {...inputProps} ref={ref} />
)}
{(inputProps) => <Toggle {...otherProps} {...inputProps} ref={ref} />}
</FormFieldWrapper>
));
ToggleField.displayName = 'ToggleField';
export const PlainToggleField = forwardRef<HTMLInputElement, Props>(
export const Toggle = forwardRef<HTMLInputElement, Props>(
({ className, size, ...otherProps }, ref) => (
<span className={classes.wrapper}>
<input
@@ -49,4 +48,4 @@ export const PlainToggleField = forwardRef<HTMLInputElement, Props>(
</span>
),
);
PlainToggleField.displayName = 'PlainToggleField';
Toggle.displayName = 'Toggle';