--- order: 3.1 title: zh-CN: 必选样式 en-US: Required style --- ## zh-CN 通过 `requiredMark` 切换必选与可选样式。 ## en-US Switch required or optional style with `requiredMark`. ```tsx import { InfoCircleOutlined } from '@ant-design/icons'; import { Button, Form, Input, Radio } from 'antd'; import React, { useState } from 'react'; type RequiredMark = boolean | 'optional'; const App: React.FC = () => { const [form] = Form.useForm(); const [requiredMark, setRequiredMarkType] = useState('optional'); const onRequiredTypeChange = ({ requiredMarkValue }: { requiredMarkValue: RequiredMark }) => { setRequiredMarkType(requiredMarkValue); }; return (
Optional Required Hidden }} >
); }; export default App; ```