Sanity Library Reference Docs
    Preparing search index...

    Interface PortableTextMarkComponentProps<M>

    Props received by Portable Text mark rendering components

    interface PortableTextMarkComponentProps<
        M extends TypedObject = ArbitraryTypedObject,
    > {
        children: ReactNode;
        markKey?: string;
        markType: string;
        renderNode: NodeRenderer;
        text: string;
        value?: M;
    }

    Type Parameters

    • M extends TypedObject = ArbitraryTypedObject

      Shape describing the data associated with this mark, if it is an annotation

    Index

    Properties

    children: ReactNode

    React child nodes of this mark

    markKey?: string

    Key for this mark. The same key can be used amongst multiple text spans within the same block, so don't rely on this for React keys.

    markType: string

    Type of mark - ie value of _type in the case of annotations, or the name of the decorator otherwise - eg em, italic.

    renderNode: NodeRenderer

    Function used to render any node that might appear in a portable text array or block, including virtual "toolkit"-nodes like lists and nested spans. You will rarely need to use this.

    text: string

    Text content of this mark

    value?: M

    Mark definition, eg the actual data of the annotation. If the mark is a simple decorator, this will be undefined