Skip to main content
rule

rtl-right-to-left-i18n-cursorrules — Cursor rule for RTL layouts

A Cursor rule that pushes the agent toward logical CSS and Tailwind utilities instead of left/right. Useful when the app has to run in Arabic, Hebrew, Persian or Urdu.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdc
Open on GitHub

What rtl-right-to-left-i18n-cursorrules-prompt-file does

The rule lays out eight areas. Logical CSS properties replace physical ones: margin-inline-start over margin-left, inset-inline-start over left. Tailwind gets the same treatment — ms-4, me-4, ps-4, pe-4, start-0, end-0. React Native has its own list: paddingStart instead of paddingLeft.

Then come bidirectional text and icons. Mixed-script strings should sit inside <bdi>, and directional icons — arrows, chevrons, back buttons — flip in RTL. Home, settings and search stay put. Strings should not be hardcoded; numbers and dates go through Intl.NumberFormat and Intl.DateTimeFormat, with dir="auto" or dir="rtl" on the root. Carousels, sliders, progress bars and swipe gestures reverse direction.

For auditing the rule points at rtlify-ai: npx rtlify-ai init installs the rules, npx rtlify-ai check finds violations, npx rtlify-ai fix repairs them. Testing advice is blunt — use real RTL content, not a mirrored LTR page, or bidirectional bugs stay hidden. The file lives at .cursor/rules/ with an .mdc extension, so outside Cursor it does nothing.

What it helps with

  • convert physical CSS properties to logical ones without editing every file by hand
  • catch Tailwind ml- and pr- classes that break an RTL layout
  • wrap user names in <bdi> so mixed-script text stops jumping
  • reverse carousels, sliders and swipe gestures when the direction flips
  • flip arrows and chevrons while leaving search and settings icons alone

Example prompts for the agent

  • Audit this component for RTL and swap physical properties for logical ones
  • Fix the Tailwind classes in src/components/Card.tsx for RTL
  • Run npx rtlify-ai check and fix what it reports

How to install rtl-right-to-left-i18n-cursorrules-prompt-file

Manually: put the files in place

.cursor/rules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about rtl-right-to-left-i18n-cursorrules-prompt-file

How do I install rtl-right-to-left-i18n-cursorrules in Cursor?

Create .cursor/rules/rtl-right-to-left-i18n-cursorrules-prompt-file.mdc and paste the rule contents into it. Cursor picks up rules from the .cursor/rules/ folder.

What does this rule do?

It gives the agent a checklist for RTL work: logical CSS properties, logical Tailwind utilities, <bdi> around mixed-script text, flipped directional icons, and auditing through rtlify-ai.

Do I need rtlify-ai for the rule to work?

No. It is a separate tool for detecting and auto-fixing violations. The rule works without it, but then you check RTL by hand.

Source text

rtl-right-to-left-i18n-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for RTL development with logical CSS properties, Tailwind logical classes, bidirectional text, and automated auditing via rtlify-ai."
globs: **/*
alwaysApply: false
---
# RTL (Right-to-Left) Development Rules

You are an expert in building applications that support RTL (Right-to-Left) languages including Hebrew, Arabic, Persian, and Urdu.

## Core Rules

### 1. Logical CSS Properties
Always use CSS logical properties instead of physical ones:
- `margin-inline-start` not `margin-left`
- `padding-inline-end` not `padding-right`
- `inset-inline-start` not `left`
- `border-inline-start` not `border-left`

### 2. Tailwind CSS Logical Classes
Use logical Tailwind utilities:
- `ms-4` not `ml-4` (margin-start)
- `me-4` not `mr-4` (margin-end)
- `ps-4` not `pl-4` (padding-start)
- `pe-4` not `pr-4` (padding-end)
- `start-0` not `left-0`
- `end-0` not `right-0`

### 3. React Native Logical Properties
Use logical properties in React Native styles:
- `paddingStart` not `paddingLeft`
- `paddingEnd` not `paddingRight`
- `marginStart` not `marginLeft`
- `marginEnd` not `marginRight`

### 4. Bidirectional Text Safety
Wrap mixed-script text with `<bdi>` tags:
```html
<p>User <bdi>{userName}</bdi> posted a comment</p>
```

### 5. Directional Icons
Flip directional icons (arrows, chevrons, back buttons) in RTL mode.
Non-directional icons (home, settings, search) should NOT be flipped.

### 6. Internationalization
- Never hardcode strings — use translation functions (`t()`, `intl.formatMessage()`)
- Use `Intl.NumberFormat` for numbers and currency
- Use `Intl.DateTimeFormat` for dates
- Set `dir="auto"` or `dir="rtl"` on root elements

### 7. RTL-Aware Components
- Carousels, sliders, and progress bars must reverse direction in RTL
- Swipe gestures must reverse in RTL
- Charts and graphs with directional axes must flip

### 8. Testing
- Always test with `dir="rtl"` on the root element
- Verify with actual RTL content, not just flipped LTR

## Automated RTL Auditing

For automated RTL violation detection and fixing, use [rtlify-ai](https://github.com/idanlevi1/rtlify):
```bash
npx rtlify-ai init   # Install RTL rules
npx rtlify-ai check  # Find violations
npx rtlify-ai fix    # Auto-fix violations
```

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set68

solidity-hardhat-cursorrules-prompt-file A Cursor rule that turns the AI assistant into a Solidity and smart contract security expert, with Hardhat-based testing and gas work. ★ 41,011repo stars snowflake-snowpark-dbt-cursorrules-prompt-file A Cursor rule that gives the agent context for Snowpark Python and dbt with the Snowflake adapter. Useful when you write transformation pipelines in either tool. ★ 41,011repo stars shopify-theme-dev-liquid A Cursor rule collecting Shopify theme practices across Liquid, JavaScript, CSS, accessibility and performance. Useful when you build a theme and want the agent to keep the structure. ★ 41,011repo stars salesforce-apex-cursorrules-prompt-file A Cursor rule that points the agent at Salesforce Apex work: queueables instead of @future, GoF patterns, and almost no comments. ★ 41,011repo stars react This rule hands Cursor a set of React conventions: component structure, hooks, state, forms and accessibility. Useful when a project has plenty of .tsx and .jsx and you want one style. ★ 41,011repo stars react-typescript-nextjs-nodejs-cursorrules-prompt- A Cursor rule that pins down React, TypeScript, Next.js 14 and Node.js conventions: functional components, RORO, minimal use client. ★ 41,011repo stars react-styled-components-cursorrules-prompt-file A Cursor rule that tells the agent how to write React code with styled-components: functional components, theming through ThemeProvider, a fixed folder layout. ★ 41,011repo stars react-query-cursorrules-prompt-file A Cursor rule that tells the agent how to write React Query code: where QueryClient lives, how hooks and query keys are named. ★ 41,011repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor