UNPKG

@tinacms/toolkit

Version:

Tina is a lightweight but powerful toolkit for creating a site editing ui with javascript components. Tina surfaces superpowers for dev’s to create, expand on and customize a simple yet intuitive ui for editing content.

50 lines (46 loc) 1.37 kB
/** */ /// <reference types="react" /> import { Field, Form } from '../../forms'; declare type DefaultItem = string | number | (() => string | number); interface ListFieldDefinititon extends Field { component: 'list'; defaultItem?: DefaultItem; field: { component: 'text' | 'textarea' | 'number' | 'select' | 'image'; }; type?: string; list?: boolean; parentTypename?: string; /** * An optional function which generates `props` for * this items's `li`. */ itemProps?: (_item: object) => { /** * The `key` property used to optimize the rendering of lists. * * If rendering is causing problems, use `defaultItem` to * generate a unique key for the item. * * Reference: * * https://reactjs.org/docs/lists-and-keys.html */ key?: string; }; } interface ListProps { input: any; meta: any; field: ListFieldDefinititon; form: any; tinaForm: Form; index?: number; } export declare const ListField: ({ tinaForm, form, field, input, meta, index }: ListProps) => JSX.Element; export declare const ListFieldPlugin: { name: string; Component: ({ tinaForm, form, field, input, meta, index }: ListProps) => JSX.Element; validate(value: any, values: any, meta: any, field: any): string; }; export {};