mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-16 23:21:00 +08:00

Some checks failed
Publish Any Commit / build (push) Has been cancelled
✅ test v6 / lint (push) Has been cancelled
✅ test v6 / test-react-legacy (18, 1/2) (push) Has been cancelled
✅ test v6 / test-react-legacy (18, 2/2) (push) Has been cancelled
✅ test v6 / test-node (push) Has been cancelled
✅ test v6 / test-react-latest (dom, 1/2) (push) Has been cancelled
✅ test v6 / test-react-latest (dom, 2/2) (push) Has been cancelled
✅ test v6 / build (push) Has been cancelled
✅ test v6 / test lib/es module (es, 1/2) (push) Has been cancelled
✅ test v6 / test lib/es module (es, 2/2) (push) Has been cancelled
✅ test v6 / test lib/es module (lib, 1/2) (push) Has been cancelled
✅ test v6 / test lib/es module (lib, 2/2) (push) Has been cancelled
👁️ Visual Regression Persist Start / test image (push) Has been cancelled
✅ test v6 / test-react-latest-dist (dist, 1/2) (push) Has been cancelled
✅ test v6 / test-react-latest-dist (dist, 2/2) (push) Has been cancelled
✅ test v6 / test-react-latest-dist (dist-min, 1/2) (push) Has been cancelled
✅ test v6 / test-react-latest-dist (dist-min, 2/2) (push) Has been cancelled
✅ test v6 / test-coverage (push) Has been cancelled
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import React from 'react';
|
|
import { Button, Flex, Form, Input, Select } from 'antd';
|
|
|
|
const App = () => {
|
|
const [form] = Form.useForm();
|
|
|
|
return (
|
|
<Form
|
|
form={form}
|
|
scrollToFirstError={{ behavior: 'instant', block: 'end', focus: true }}
|
|
style={{ paddingBlock: 32 }}
|
|
labelCol={{ span: 6 }}
|
|
wrapperCol={{ span: 14 }}
|
|
>
|
|
<Form.Item label={null}>
|
|
<Button onClick={() => form.scrollToField('bio')}>Scroll to Bio</Button>
|
|
</Form.Item>
|
|
|
|
<Form.Item name="username" label="UserName" rules={[{ required: true }]}>
|
|
<Input />
|
|
</Form.Item>
|
|
|
|
<Form.Item label="Occupation" name="occupation">
|
|
<Select
|
|
options={[
|
|
{ label: 'Designer', value: 'designer' },
|
|
{ label: 'Developer', value: 'developer' },
|
|
{ label: 'Product Manager', value: 'product-manager' },
|
|
]}
|
|
/>
|
|
</Form.Item>
|
|
|
|
<Form.Item name="motto" label="Motto">
|
|
<Input.TextArea rows={4} />
|
|
</Form.Item>
|
|
|
|
<Form.Item name="bio" label="Bio" rules={[{ required: true }]}>
|
|
<Input.TextArea rows={6} />
|
|
</Form.Item>
|
|
|
|
<Form.Item label={null}>
|
|
<Flex gap="small">
|
|
<Button type="primary" htmlType="submit">
|
|
Submit
|
|
</Button>
|
|
<Button danger onClick={() => form.resetFields()}>
|
|
Reset
|
|
</Button>
|
|
</Flex>
|
|
</Form.Item>
|
|
</Form>
|
|
);
|
|
};
|
|
|
|
export default App;
|