Back to Nocobase

DrawerFormLayout

docs/docs/en/shared-components/form/drawer-form-layout.md

2.1.111.1 KB
Original Source

DrawerFormLayout

DrawerFormLayout is used to put a standard form in a drawer.

Basic Usage

tsx
import { DrawerFormLayout } from '@nocobase/client-v2';

ctx.viewer.drawer({
  width: '50%',
  closable: true,
  content: () => (
    <DrawerFormLayout title={t('Add provider')} onSubmit={handleSubmit}>
      <Form form={form} layout="vertical">
        <Form.Item name="name" label={t('Name')} rules={[{ required: true }]}>
          <Input />
        </Form.Item>
      </Form>
    </DrawerFormLayout>
  ),
});

API

PropTypeDescription
titleReact.ReactNodeTitle content
childrenReact.ReactNodeContent rendered inside the component
onSubmit`() => voidPromise<void>`
submittingbooleanLoading state of the submit button
submitTextReact.ReactNodeSubmit button text
cancelTextReact.ReactNodeCancel button text
footerReact.ReactNodeReplace the default footer