# code-snippets/3.9.6/js/components/EditorSidebar/controls/RTLControl.tsx

Code Snippets, version 3.9.6. 25 lines.

- Page: https://pluginprobe.com/plugins/code-snippets/3.9.6/code/js/components/EditorSidebar/controls/RTLControl.tsx
- Raw: https://pluginprobe.com/plugins/code-snippets/3.9.6/raw/js/components/EditorSidebar/controls/RTLControl.tsx
- Modified: 2025-11-14T01:20:22+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-snippets/3.9.6/code/js/components/EditorSidebar/controls/RTLControl.tsx#L10-L20`.

```tsx
import React from 'react'
import { __ } from '@wordpress/i18n'
import { useSnippetForm } from '../../../hooks/useSnippetForm'

export const RTLControl: React.FC = () => {
	const { codeEditorInstance } = useSnippetForm()

	return (
		<div className="inline-form-field">
			<h4>
				<label htmlFor="snippet-code-direction">
					{__('Code Direction', 'code-snippets')}
				</label>
			</h4>

			<select id="snippet-code-direction" onChange={event =>
				codeEditorInstance?.codemirror.setOption('direction', 'rtl' === event.target.value ? 'rtl' : 'ltr')
			}>
				<option value="ltr">{__('LTR', 'code-snippets')}</option>
				<option value="rtl">{__('RTL', 'code-snippets')}</option>
			</select>
		</div>
	)
}

```
