Override a Label in the Mapbox Standard Style
In the Mapbox Standard Style, the complexity of its layer styling is abstracted away — you can configure it with predefined variables, but you can't directly edit its layers. This is by design, and allows you to benefit from continuous improvements by our map designers. So what do you do when you need a label to say something different, appear at a different zoom level, or simply not appear at all? Here's a technique for surgically replacing a single label with your own, while keeping everything else in the Standard style untouched and precisely matching the label style. In the embedded example below, we've replaced the label for "New York" with "New Amsterdam". Why they changed it, I can't say. 😉 Using a classic style? If you're on a classic Mapbox style where you have direct access to...
In the Mapbox Standard Style, the complexity of its layer styling is abstracted away — you can configure it with predefined variables, but you can't directly edit its layers. This is by design, and allows you to benefit from continuous improvements by our map designers. So what do you do when you need a label to say something different, appear at a different zoom level, or simply not appear at all? Here's a technique for surgically replacing a single label with your own, while keeping everything else in the Standard style untouched and precisely matching the label style. In the embedded example below, we've replaced the label for "New York" with "New Amsterdam". Why they changed it, I can't say. 😉 Using a classic style? If you're on a classic Mapbox style where you have direct access to edit symbol layers, there's a simpler approach: override the label text using an expression directly on the layer. See Customize label text in the Mapbox docs. This post is specifically about the Standard style, where internal layers are not editable — which requires a different technique. Step 1: Get the exact coordinates and properties of the label feature Most map labels come from the source layer in the Mapbox Streets tileset. Here's a simple map that shows only the source layer's points (and water features for reference). Click a label and you will see its full data, including the coordinates and properties: Copy the full GeoJSON Feature. Fields like , , , , , and all control how the label is styled and at which zoom levels it appears. You'll need to match these when building your replacement feature. Step 2: Build a custom style that imports Standard Instead of loading the Standard style directly, create a top-level style JSON that imports Standard and adds your own source alongside it: The and URLs must point to the Standard style's assets. Without them, the dot icons and fonts used by settlement labels won't resolve. Step 3: Add a layer that mirrors the Standard style's styling The Standard style renders city labels using layers like and . You can inspect these by calling on a Standard style map. They contain complex Mapbox Style expressions to support config properties like , , and . For a simple replacement, you can strip out that complexity and hardcode the resolved values for your target preset. Here's what looks like for a , non-capital feature in the default day preset: The renderer's symbol placement engine will suppress the original label when your replacement occupies the same location — in most cases no extra work is needed. If the original label bleeds through, you can add a small layer around the point to suppress it explicitly. Caveats This layer is yours to maintain. The Mapbox Standard style is actively maintained and updated. If Mapbox changes how settlement labels are styled in a future release, your custom layer won't automatically follow. You'll need to re-inspect the internal layers and update your config to match. Hardcoded values won't honor Standard style config. By resolving , , etc. to their defaults, you've opted out of those customization hooks. If you want your label to respond to theme or light preset changes, bring in the full layer config and schema instead of hardcoding values. Label placement is context-dependent. The value in the tileset is computed based on surrounding label density at tile generation time. In isolation, your label will use the correct anchor direction, but the exact placement may look slightly different than it would surrounded by other labels.