Skip to main content
Refine AI
Version: 3.xx.xx

crud-live-preview

localhost:3000
Live previews only work with the latest documentation.
import { Create, Form, Select, useSelect, useForm } from "@pankod/refine-antd";

interface ICategory {
id: number;
title: string;
}

const PostCreate: React.FC = () => {
const { formProps, saveButtonProps } = useForm<ICategory>();

const { selectProps } = useSelect<ICategory>({
resource: "categories",
});

return (
<Create saveButtonProps={saveButtonProps}>
<Form {...formProps} layout="vertical">
<Form.Item
label="Category"
placeholder="Select a category"
name={["category", "id"]}
rules={[
{
required: true,
},
]}
>
<Select {...selectProps} />
</Form.Item>
</Form>
</Create>
);
};