Text label configuration for geometries.
Controls text labels displayed at the center of polygon geometries.
// Simple text fieldconst textConfig: GeometryTextConfig = { textField: ['get', 'name']};// Conditional textconst conditionalText: GeometryTextConfig = { textField: ['case', ['has', 'title'], ['get', 'title'], ['get', 'id']]}; Copy
// Simple text fieldconst textConfig: GeometryTextConfig = { textField: ['get', 'name']};// Conditional textconst conditionalText: GeometryTextConfig = { textField: ['case', ['has', 'title'], ['get', 'title'], ['get', 'id']]};
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 propertytextField: ['get', 'name']// Concatenate propertiestextField: ['concat', ['get', 'name'], ' (', ['get', 'area'], ' km²)']// Conditional texttextField: ['case', ['has', 'label'], ['get', 'label'], ''] Copy
// Display feature propertytextField: ['get', 'name']// Concatenate propertiestextField: ['concat', ['get', 'name'], ' (', ['get', 'area'], ' km²)']// Conditional texttextField: ['case', ['has', 'label'], ['get', 'label'], '']
Text label configuration for geometries.
Controls text labels displayed at the center of polygon geometries.
Example