Sanity Library Reference Docs
    Preparing search index...

    Interface TemplateItem

    Represents the items that can appear in different parts of the Sanity studio when creating new documents - examples being the "New document" button in the navigation bar, the corresponding button in panes, as well as the "Create new" button on references.

    Differs from an actual template in that a single template can be pointed at by multiple different items. This is useful when the template can create different values based on passed parameters.

    interface TemplateItem {
        description?: string;
        i18n?: I18nTextRecord<"title">;
        icon?: Element | ElementType<any, (keyof IntrinsicElements)>;
        initialDocumentId?: string;
        parameters?: { [key: string]: any };
        subtitle?: string;
        templateId: string;
        title?: string;
    }

    Hierarchy (View Summary)

    Index

    Properties

    description?: string

    No longer used anywhere

    i18n?: I18nTextRecord<"title">
    icon?: Element | ElementType<any, (keyof IntrinsicElements)>

    React icon for the item, if any. Defaults to the icon for the associated template.

    initialDocumentId?: string

    Experimental: not fully supported yet Hints at what the document ID for the new document should be. Leave undefined to let the system decide.

    parameters?: { [key: string]: any }

    Parameters for the template - an object of any JSON-serializable values

    subtitle?: string

    No longer used anywhere

    templateId: string

    ID for the template. Must be unique within the set of templates.

    title?: string

    Title for the item. Defaults to the title of the associated template.