This is the documentation of version 1.0.0-rc.2. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias FeatureLabelConfig<F>

    FeatureLabelConfig: LabelConfig & {
        title?:
            | ((feature: F) => string)
            | DataDrivenPropertyValueSpecification<string>;
    }

    A LabelConfig that also sets what the label says, for the labels a module writes beside the features it shows.

    Type Parameters

    • F

      The feature the title function receives.

    Type Declaration

    • Optionaltitle?: ((feature: F) => string) | DataDrivenPropertyValueSpecification<string>

      Text content for the label.

      The SDK calls a function once per feature when it shows it, and draws its result as given. A MapLibre expression, which the layer evaluates per feature over the properties the feature is drawn with, replaces the module's whole label text.

      // Function
      title: (feature) => feature.properties.poi?.name || 'Unknown'

      // MapLibre expression
      title: ['get', 'title']