ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
48 lines • 1.71 kB
text/typescript
import * as React from 'react';
import { type ReactNode } from 'react';
import type { InputProps } from "../../form/useInput.cjs";
/**
* To edit arrays of data embedded inside a record, <ArrayInputBase> creates a list of sub-forms.
*
* @example
*
* import { ArrayInputBase } from 'ra-core';
* import { SimpleFormIterator, DateInput, TextInput } from 'my-react-admin-ui';
*
* <ArrayInputBase source="backlinks">
* <SimpleFormIterator>
* <DateInput source="date" />
* <TextInput source="url" />
* </SimpleFormIterator>
* </ArrayInputBase>
*
* <ArrayInputBase> allows the edition of embedded arrays, like the backlinks field
* in the following post record:
*
* {
* id: 123
* backlinks: [
* {
* date: '2012-08-10T00:00:00.000Z',
* url: 'http://example.com/foo/bar.html',
* },
* {
* date: '2012-08-14T00:00:00.000Z',
* url: 'https://blog.johndoe.com/2012/08/12/foobar.html',
* }
* ]
* }
*
* <ArrayInputBase> expects a single child, which must be a *form iterator* component.
* A form iterator is a component accepting a fields object as passed by
* react-hook-form-arrays's useFieldArray() hook, and defining a layout for
* an array of fields.
*
* @see {@link https://react-hook-form.com/docs/usefieldarray}
*/
export declare const ArrayInputBase: (props: ArrayInputBaseProps) => React.JSX.Element;
export declare const getArrayInputError: (error: any) => any;
export interface ArrayInputBaseProps extends Omit<InputProps, 'disabled' | 'readOnly'> {
children: ReactNode;
}
//# sourceMappingURL=ArrayInputBase.d.ts.map