whatisgithub

What is rtl-css-js?

kentcdodds/rtl-css-js — explained in plain English

Analysis updated 2026-08-08 · repo last pushed 2023-04-26

166JavaScriptAudience · developerComplexity · 2/5DormantSetup · easy

In one sentence

A JavaScript utility that automatically flips CSS-in-JS style objects for right-to-left languages like Arabic and Hebrew, converting properties like paddingLeft to paddingRight so developers don't have to maintain separate style sets.

Mindmap

mindmap
  root((repo))
    What it does
      Flips styles for RTL
      Handles padding and margins
      Supports noflip comments
    Tech stack
      JavaScript
      CSS-in-JS libraries
      JSS and Fela plugins
    Use cases
      Arabic locale support
      Hebrew locale support
      Multi-direction web apps
    Limitations
      Simple gradient text swap
      Cannot convert CSS variables
      Work in progress

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Add Arabic or Hebrew language support to a web app that styles with JavaScript objects.

USE CASE 2

Automatically flip padding, margin, border, and positioning values for right-to-left layouts.

USE CASE 3

Prevent specific style rules from flipping using a noflip comment when a value should stay unchanged.

USE CASE 4

Integrate RTL conversion into JSS, Fela, or Aphrodite styling workflows without maintaining duplicate styles.

What is it built with?

JavaScriptCSS-in-JS

How does it compare?

kentcdodds/rtl-css-jsfrankchiu-dev/claude-codex-usage-dashboardtasihi89/canvas-hand
Stars166166165
LanguageJavaScriptJavaScriptJavaScript
Last pushed2023-04-26
MaintenanceDormant
Setup difficultyeasymoderateeasy
Complexity2/52/52/5
Audiencedeveloperdevelopervibe coder

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Install via npm or yarn and call the conversion function on a JavaScript style object, no external infrastructure required.

The license is not specified in the repository explanation.

So what is it?

If you're building a web app that needs to support languages written right-to-left, like Arabic or Hebrew, you have to flip the entire layout. Padding that goes on the left in English needs to move to the right, background gradients need to reverse direction, and so on. Doing this manually for every style rule is tedious and error-prone. This tool, rtl-css-js, automates that conversion for projects that write their styling rules as JavaScript objects rather than traditional CSS files. You pass it a JavaScript object representing your styles, and it returns a new object with all the direction-specific properties flipped. So paddingLeft: 23 becomes paddingRight: 23, and the same logic applies to margins, borders, positioning, and similar properties. You can also add a special / @noflip / comment to any value if you want a particular rule to stay as-is and not be converted. It handles both camelCase and kebab-case property names. This is aimed at developers using "CSS in JS" libraries, tools that let you write styles as JavaScript objects instead of separate .css files. For example, if you're using a styling library like JSS, Fela, or Aphrodite and you need your app to work for right-to-left locales, this handles the conversion so you don't have to maintain two separate sets of styles. Several plugins in that ecosystem already build on top of it. There are a couple of limitations worth knowing about. For background images and gradients, it does a simple text replacement to swap directional keywords, which works but requires some care with how you name image files or write gradient syntax. And for CSS variables (the var() syntax), it can't convert the contents because those values aren't known until the browser actually renders the page. The README also notes the project is still a work in progress.

Copy-paste prompts

Prompt 1
I have a CSS-in-JS style object with paddingLeft, marginLeft, and right border properties. Use rtl-css-js to convert this object for right-to-left languages like Arabic and show me the flipped output.
Prompt 2
Show me how to use rtl-css-js with a JSS styling setup so that my app automatically flips styles when a right-to-left locale is active.
Prompt 3
I want one specific style rule to not be flipped even when converting to RTL. How do I add the noflip comment using rtl-css-js, and show me a before-and-after example.
Prompt 4
Convert this JavaScript style object to RTL using rtl-css-js, including both camelCase and kebab-case property names, and explain which properties changed.

Frequently asked questions

What is rtl-css-js?

A JavaScript utility that automatically flips CSS-in-JS style objects for right-to-left languages like Arabic and Hebrew, converting properties like paddingLeft to paddingRight so developers don't have to maintain separate style sets.

What language is rtl-css-js written in?

Mainly JavaScript. The stack also includes JavaScript, CSS-in-JS.

Is rtl-css-js actively maintained?

Dormant — no commits in 2+ years (last push 2023-04-26).

What license does rtl-css-js use?

The license is not specified in the repository explanation.

How hard is rtl-css-js to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is rtl-css-js for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.