---
title: "Directionality plugin"
description: "Toolbar buttons for setting the left-to-right or right-to-left direction of content."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/directionality/"
md_url: "https://www.tiny.cloud/docs/tinymce/6/directionality/index.md"
version: "6"
last_updated: "2022-03-30T07:08:51Z"
tokens: 345
---
Important This page documents TinyMCE 6. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../latest/directionality/).
# Directionality plugin

This plugin adds directionality controls to the toolbar, enabling TinyMCE to better handle languages written from right to left. It also adds a toolbar button for each of its values, `ltr` for left-to-right text and `rtl` for right-to-left text.

## Basic setup

```js
tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  plugins: 'directionality',
  toolbar: 'ltr rtl'
});
```

## Toolbar buttons

The Directionality plugin provides the following toolbar buttons:

| Toolbar button identifier | Description |
| --- | --- |
| `ltr` | Sets the directionality of contents to ltr. |
| `rtl` | Sets the directionality of contents to rtl. |

These toolbar buttons can be added to the editor using:

- The [`toolbar`](../toolbar-configuration-options/#toolbar) configuration option.
- The [`quickbars_insert_toolbar`](../quickbars/#quickbars_insert_toolbar) configuration option.
- [Custom Context toolbars](../contexttoolbar/).

## Commands

The Directionality plugin provides the following TinyMCE commands.

| Command | Description |
| --- | --- |
| mceDirectionLTR | Changes the directionality to LTR. |
| mceDirectionRTL | Changes the directionality to RTL. |

Examples
```js
tinymce.activeEditor.execCommand('mceDirectionLTR');
tinymce.activeEditor.execCommand('mceDirectionRTL');
```
