diff --git a/packages/co-design-core/src/components/Checkbox/Checkbox.tsx b/packages/co-design-core/src/components/Checkbox/Checkbox.tsx index e00d2fc7..ca3d4df6 100644 --- a/packages/co-design-core/src/components/Checkbox/Checkbox.tsx +++ b/packages/co-design-core/src/components/Checkbox/Checkbox.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { ClassNames, CoComponentProps } from '@co-design/styles'; import { CheckboxIcon } from './CheckboxIcon'; import { View } from '../View'; @@ -59,6 +59,10 @@ export const Checkbox = ({ onChange?.(event); }; + useEffect(() => { + setCheck(checked); + }, [checked]); + return ( + {label && ( - + ); }, ); diff --git a/packages/co-design-core/src/components/Input/stories/Input.stories.tsx b/packages/co-design-core/src/components/Input/stories/Input.stories.tsx index 09b434cb..7f7c5d62 100644 --- a/packages/co-design-core/src/components/Input/stories/Input.stories.tsx +++ b/packages/co-design-core/src/components/Input/stories/Input.stories.tsx @@ -107,8 +107,10 @@ export const Textarea = { export const WithLabel = { render: (props) => { return ( -
+
+ +
); },