string
Typetype StringField = {label: stringname: stringtype: 'string'list?: booleanoptions?: (string | { value: string; label: string })[]// Represents the "body" of a markdown fileisBody?: boolean// See https://tina.io/docs/extending-tina/overview/ for customizing the UIui?: {label?: stringdescription?: stringcomponent?: FC<any> | string | nullparse?: (value: string | string[], name: string, field: F) => anyformat?: (value: string | string[], name: string, field: F) => any// defaultItem can only can be used when {list: true}defaultItem?: () => string | stringvalidate?(// string or string[] depends on list true or falsevalue: string | string[],allValues: any,meta: any,field: UIField<F, Shape>): string | undefined | void}}
Tina will generate the appropriate component depending on the configuration provided.
{type: 'string',name: 'title',label: 'Title'}
Setting list: true will make the value an array
{type: 'string',name: 'title',label: 'Title',list: true}
Setting list: true and providing options will make the value an array with a selection list
{type: 'string',name: 'title',label: 'Title',list: true,options: [{value: "movies",label: "Movies"}, {value: "music",label: "Music"}]}
When working with markdown, you can indicate that a given field should represent the markdown body
{type: 'string',name: 'body',label: 'Body',// Indicates this field should repesent the file's bodyisBody: true}
By default, the text field is used for strings. To use a different core field plugin, specify it with the ui.component property
{label: "Description",name: "description",type: "string",ui: {component: "textarea"}}
You can create your own components
{label: "Title",name: "title",type: "string",ui: {component: ({ input }) => {return (<div><label htmlFor="title">Title: </label><input {...input}></input></div>);},},}
Last Edited: September 12, 2024
© TinaCMS 2019–2024