- Enable RTL for all controls
- Enable RTL for an individual control
Contact Support
Right-To-Left support in Syncfusion® JavaScript Controls
7 May 20253 minutes to read
Right-to-Left (RTL) support allows applications to effectively communicate with users who use languages that are written from right to left, such as Arabic, Hebrew, etc.
Syncfusion® JavaScript (ES5) controls support for right-to-left (RTL) by setting the enableRtl property to true
. This adds the class name e-rtl
to the control element and renders all Syncfusion® JavaScript controls in a right-to-left direction.
Enable RTL for all controls
To enable Right-To-Left (RTL) support for all controls, users can set the enableRtl property directly in their application. Here is an example code snippet using the ListView control:
// Enables Right to left alignment for all controls
ej.base.enableRtl(true);
var rtlListObj = new ej.lists.ListView({
dataSource: data,
headerTitle: 'کاریں',
showHeader: true,
height: '350px'
});
rtlListObj.appendTo('#listview');
<!DOCTYPE html><html><head>
<meta charset="UTF-8">
<link href="https://cdn.syncfusion.com/ej2/29.2.4/ej2-lists/styles/material.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/29.2.4/dist/ej2.min.js" type="text/javascript"></script>
<script src="es5-datasource.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="listview"></div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>
Enable RTL for an individual control
To enable Right-To-Left (RTL) support for an individual control, users can set the enableRtl property in the control’s options. Here is an example code snippet using the ListView control:
var rtlListObj = new ej.lists.ListView({
dataSource: data,
enableRtl: true,
headerTitle: 'کاریں',
showHeader: true,
height: '350px'
});
rtlListObj.appendTo('#listview');
<!DOCTYPE html><html><head>
<link href="https://cdn.syncfusion.com/ej2/29.2.4/ej2-lists/styles/material.css" rel="stylesheet">
<script src="https://cdn.syncfusion.com/ej2/29.2.4/dist/ej2.min.js" type="text/javascript"></script>
<script src="es5-datasource.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id="container">
<div id="listview"></div>
</div>
<script>
var ele = document.getElementById('container');
if(ele) {
ele.style.visibility = "visible";
}
</script>
<script src="index.js" type="text/javascript"></script>
</body></html>