MapLibreMapLibre GL JS DocsExamplesAdd support for right-to-left scripts

Add support for right-to-left scripts

Use the mapbox-gl-rtl-text plugin to support right-to-left languages such as Arabic and Hebrew.

By setting the lazy parameter to true, the plugin is only loaded when the map first encounters Hebrew or Arabic text.

<!DOCTYPE html>
<meta charset="utf-8" />
<title>Add support for right-to-left scripts</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="[email protected]/dist/maplibre-gl.js"></script>
<link href="[email protected]/dist/maplibre-gl.css" rel="stylesheet" />
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
<div id="map"></div>
'[email protected]/mapbox-gl-rtl-text.min.js',
true // Lazy load the plugin
var map = new maplibregl.Map({
container: 'map',
center: [44.3763, 33.2788],
zoom: 11