import React, { useState } from 'react'; import { Checkbox, Divider } from 'antd'; import type { CheckboxChangeEvent } from 'antd/es/checkbox'; import type { CheckboxValueType } from 'antd/es/checkbox/Group'; const CheckboxGroup = Checkbox.Group; const plainOptions = ['Apple', 'Pear', 'Orange']; const defaultCheckedList = ['Apple', 'Orange']; const App: React.FC = () => { const [checkedList, setCheckedList] = useState(defaultCheckedList); const checkAll = plainOptions.length === checkedList.length; const indeterminate = checkedList.length > 0 && checkedList.length < plainOptions.length; const onChange = (list: CheckboxValueType[]) => { setCheckedList(list); }; const onCheckAllChange = (e: CheckboxChangeEvent) => { setCheckedList(e.target.checked ? plainOptions : []); }; return ( <> Check all ); }; export default App;