RTL Right-to-Left Development Rules

RTL Right-to-Left Development Rules

Teaches a coding agent to build right-to-left friendly interfaces using CSS logical properties, Tailwind logical classes, bidi text handling and icon flipping.


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:

<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):

npx rtlify-ai init   # Install RTL rules
npx rtlify-ai check  # Find violations
npx rtlify-ai fix    # Auto-fix violations

Public domain (CC0 1.0) · by awesome-cursorrules contributors · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 13,392 prompts

More by @OpenSourceBuffGuy

See all
White futuristic car lifts off from city traffic prompt image

White futuristic car lifts off from city traffic

Generates a 13-second realistic video where a white angular futuristic car in city traffic suddenly lifts off like a rocket, looping through the sky with smoke trails.

video-prompt, seedance, sci-fi, futuristic, cars, cityscape, timed-beats, multi-shot, cinematic, visual-effects, scene-transitions, photorealistic, character-consistency, text-rendering, transformation, long-form, humorous, camera-movement, natural-light, negative-prompt

Korean subway woman smashes train door glass prompt image

Korean subway woman smashes train door glass

Describes a 30-second Korean subway action-comedy where a woman smashes a train door's glass to pull a laughing man out, using uploaded images to keep characters consistent.

video-prompt, seedance, action, korea, character-consistency, reference-image, photorealistic, handheld, negative-prompt, humorous, sound-effects, timed-beats, cinematic, multi-shot, guardrails, structured-output, lip-sync

Designer toy 3D caricature with original photo inset prompt image

Designer toy 3D caricature with original photo inset

Turns an uploaded photo into a premium designer-toy 3D caricature with an oversized head, plus the original photo as a corner inset for a before and after.

image-prompt, reference-image, face-reference, negative-prompt, 3d-render, caricature, action-figure, toys, portrait, before-and-after, studio-lighting, soft-lighting, photorealistic, square-format, mockup, structured-output, gpt-image, chatgpt, for-content-creators, for-artists, medium-shot

Reviews

Loading reviews…

Discussion

Loading comments…