Sanity Library Reference Docs
    Preparing search index...

    Interface BlockAnnotationDefinition

    Schema definition for a text block annotation object.

    {
    name: 'blockContent',
    title: 'Content',
    type: 'array',
    of: [
    {
    type: 'block',
    marks: {
    annotations: [
    {
    type: 'object',
    name: 'link',
    fields: [
    {
    type: 'string',
    name: 'href',
    },
    ],
    },
    ]
    },
    }
    ]
    }
    interface BlockAnnotationDefinition {
        components?: { annotation?: ComponentType<BlockAnnotationProps> };
        deprecated?: DeprecatedProperty;
        description?: string | Element;
        fields: FieldDefinition<
            | "string"
            | "number"
            | "boolean"
            | "object"
            | "text"
            | "crossDatasetReference"
            | "reference"
            | "image"
            | "document"
            | "url"
            | "email"
            | "date"
            | "block"
            | "array"
            | "datetime"
            | "file"
            | "geopoint"
            | "globalDocumentReference"
            | "slug"
            | "sanity.video",
            undefined,
        >[];
        fieldsets?: FieldsetDefinition[];
        groups?: FieldGroupDefinition[];
        hidden?: ConditionalProperty;
        icon?: ReactNode
        | ComponentType<{}>;
        initialValue?: InitialValueProperty<any, Record<string, unknown>>;
        name: string;
        options?: ObjectOptions;
        preview?: PreviewConfig;
        readOnly?: ConditionalProperty;
        renderMembers?: ObjectRenderMembersCallback;
        title?: string;
        type: "object";
        validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    components?: { annotation?: ComponentType<BlockAnnotationProps> }
    deprecated?: DeprecatedProperty
    description?: string | Element
    fields: FieldDefinition<
        | "string"
        | "number"
        | "boolean"
        | "object"
        | "text"
        | "crossDatasetReference"
        | "reference"
        | "image"
        | "document"
        | "url"
        | "email"
        | "date"
        | "block"
        | "array"
        | "datetime"
        | "file"
        | "geopoint"
        | "globalDocumentReference"
        | "slug"
        | "sanity.video",
        undefined,
    >[]

    Object must have at least one field. This is validated at Studio startup.

    fieldsets?: FieldsetDefinition[]
    icon?: ReactNode | ComponentType<{}>
    initialValue?: InitialValueProperty<any, Record<string, unknown>>
    name: string
    options?: ObjectOptions
    preview?: PreviewConfig

    Callback that allows developers to customize the members of the object input. It can be used to add decoration members to the object input, instead of using empty fields. For example:

    import { Decoration } from './Decoration'

    renderMembers: (members) => {
    return [
    ...members,
    {
    key: 'decoration',
    kind: 'decoration',
    component: Decoration,
    },
    ]
    title?: string
    type: "object"
    validation?: ValidationBuilder<ObjectRule, Record<string, unknown>>