TomTom Maps for JavaScript
    Preparing search index...

    Type Alias GeometryTextConfig

    Text label configuration for geometries.

    Controls text labels displayed at the center of polygon geometries.

    // Simple text field
    const textConfig: GeometryTextConfig = {
    textField: ['get', 'name']
    };

    // Conditional text
    const conditionalText: GeometryTextConfig = {
    textField: ['case', ['has', 'title'], ['get', 'title'], ['get', 'id']]
    };
    type GeometryTextConfig = {
        textField: DataDrivenPropertyValueSpecification<string>;
    }
    Index

    Properties

    Properties

    textField: DataDrivenPropertyValueSpecification<string>

    Text content to display as label.

    Must be a MapLibre expression that evaluates to a string. Labels are positioned at the geometry's center point.

    // Display feature property
    textField: ['get', 'name']

    // Concatenate properties
    textField: ['concat', ['get', 'name'], ' (', ['get', 'area'], ' km²)']

    // Conditional text
    textField: ['case', ['has', 'label'], ['get', 'label'], '']