Sanity Library Reference Docs
    Preparing search index...

    Interface ResolvedTemplate<Params, Value>Beta

    A template as produced by configuration resolution.

    Unlike Template—the authoring type developers use with the schema.templates configuration—a resolved template may carry a singleton tag. The tag is set by Studio (never by developers), so it is deliberately omitted from the authoring type.

    interface ResolvedTemplate<Params = any, Value = any> {
        description?: string;
        i18n?: I18nTextRecord<"title">;
        icon?: ComponentType;
        id: string;
        parameters?: TemplateParameter[];
        schemaType: string;
        singleton?: string;
        title: string;
        value: InitialValueProperty<Params, Value>;
    }

    Type Parameters

    • Params = any
    • Value = any

    Hierarchy (View Summary)

    Index

    Properties

    description?: string

    Template description. Rendered in places such as the "new document" dialog. Optional.

    No longer used

    i18n?: I18nTextRecord<"title">
    icon?: ComponentType

    Template icon. Rendered in places such as the "new document" dialog. Optional. Inferred from the schema type icon if not set.

    id: string

    Template ID. Automatically generated templates will have the same ID as the schema type name.

    parameters?: TemplateParameter[]

    Array of parameters the template accepts. Currently not used (any parameters are accepted), but by defining parameters, the templates that require parameters can be identified and excluded from UIs that do not provide them.

    schemaType: string

    Schema type name the template belongs to. For the automatically generated templates, this will be equal to the id property.

    singleton?: string

    The singleton definition id this template provides the initial value for.

    Set on the templates Studio generates for the document.singletons configuration. Templates carrying this property are never offered as "create new" options.

    Only one template may carry a given singleton definition id.

    title: string

    Template title.

    Value to use as initial value. Can either be a static object value, or a function that resolves to an object value. If using a function, it can be given a set of parameters, which can then determine the value that is returned.