Right to left
Half this platform’s customers publish in Arabic. This is the page that makes a theme good rather than merely accepted.
These rules are enforced by validation, not left to review. They are also the rules most worth understanding rather than merely obeying, because the failures they prevent are invisible: a theme that breaks in Arabic does not throw, it just looks wrong to people who are not in the room.
Logical properties only
margin-left, padding-right, border-left, left:, right:, text-align: left|right, float: left|right and transform-origin: left|right are refused. Use the logical form.
/* no */ margin-left: 24px; inset-inline: auto; text-align: left;
/* yes */ margin-inline-start: 24px; inset-inline-end: 0; text-align: start;Exempt, because they describe a picture rather than a reading order: background-position, gradient angles, box-shadow offsets and border-radius corners. A shadow falls the same way in both scripts.
The small-label device
Eight of the eleven reference templates this library’s designs were measured from carry their entire eyebrow signal on text-transform: uppercase plus positive letter-spacing, between 0.1em and 0.3em.
Arabic has no letter case, so the transform does nothing — and positive tracking severs the cursive joins that make the script legible, so the tracking is worse than nothing. A theme built that way loses every eyebrow on an Arabic page, and nothing reports it, because the label does not disappear: it stops being a label.
So a component never writes text-transform: uppercase. It marks the element class="cmp-label" and the theme decides, through its labelStyle token.
caps- Uppercase at 0.12em in Latin. The ONLY value that resolves differently per script: in Arabic it becomes a weight contrast.
weight- Heavier and smaller. Works identically in both.
rule- A 32px hairline prefix.
dot- An 8px dot prefix.
accent- Set in the accent colour.
Tracking a component owns
When your component tracks its own type — a nav row, a brand mark, a button — multiply by the flag rather than dropping the value. Latin keeps exactly what you wrote; Arabic gets zero.
letter-spacing: calc(var(--theme-tracking-ok, 1) * 0.08em);This applies to NEGATIVE tracking too. Anything past about -0.015em on large type distorts Arabic joins as much as positive tracking severs them.
Things that are not mirrored
- Optical nudges. A
translate(0.2em, 0)compensating a trailing letter-space, a negative margin cancelling a tracked-out word — these are calibrated to Latin side bearings and cap heights, and are wrong in both sign and magnitude for Arabic. Multiply them by--theme-tracking-okas well. - Quotation marks. Arabic uses « ». It is not a 180° rotation of the Latin mark, so a closing quote built as
scale(-1, -1)of the opening one is simply wrong. - Play triangles, logos and brand marks must not mirror. Chevrons, "next" arrows and breadcrumb separators must.
- Numerals. Decide Western or Arabic-Indic per locale and format through
Intl.NumberFormat. Never build an ordinal by string concatenation inside a template — the decision is foreclosed the moment you do. - Character-by-character reveals are impossible in a joining script. A letter’s shape depends on its neighbours, so revealing one at a time redraws the ones already shown.
Bidi isolation
Wrap any bidi-neutral run that sits between scripts — a | separator, a / in a breadcrumb, a % beside a number, a Latin product name inside Arabic prose — in unicode-bidi: isolate or an explicit dir. Without it the run migrates to the wrong end, and the bug only appears with real content.
Arabic typefaces
fontsAr is required and is chosen, not inherited. None of the Latin families ships an Arabic subset, so a theme without it renders every Arabic heading in a system fallback with Latin metrics: wrong baseline, wrong weight, wrong spacing.
Six Arabic families are bundled: Cairo, Tajawal, Almarai, Amiri, Noto Kufi Arabic and IBM Plex Sans Arabic. A family outside that list gets its CSS variable written and no stylesheet fetched — a silent failure that reads as "the font just doesn’t apply".