Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 431/checkbox initial checked #448

Merged
merged 1 commit into from
May 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/react/src/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
StyledCheckboxText
} from './checkbox.styles';
import { mapPropsToReactAriaAttr } from './utils';
import { __DEV__ } from '../utils/assertion';
import clsx from '../utils/clsx';

interface Props
Expand Down Expand Up @@ -91,6 +92,8 @@ const Checkbox = React.forwardRef<HTMLLabelElement, CheckboxProps>(
labelColor,
animated,
autoFocus,
// @ts-ignore
initialChecked,
...props
} = checkboxProps;

Expand Down Expand Up @@ -205,7 +208,10 @@ const Checkbox = React.forwardRef<HTMLLabelElement, CheckboxProps>(

Checkbox.defaultProps = defaultProps;

Checkbox.displayName = 'NextUI.Checkbox';
if (__DEV__) {
Checkbox.displayName = 'NextUI.Checkbox';
}

Checkbox.toString = () => '.nextui-checkbox';

type CheckboxComponent<T, P = {}> = React.ForwardRefExoticComponent<
Expand Down