Skip to content
Okaapiأوكابي
Framework for the code
Theme
Okaapi on GitHub

Chapter 02 Foundations

Right to left

Arabic is a first language here. Set lang and dir on the page; every component turns by itself.

Logical properties

The kit writes start and end, never left and right. So should you.

WriteInstead ofTailwindFor
margin-inline-startmargin-leftms-4Space before, on the reading side.
padding-inline-endpadding-rightpe-4Space after.
inset-inline-startleftstart-0Position from the start edge.
border-inline-startborder-leftborder-s-4A start bar, like the side bar current link.
text-align: starttext-align: lefttext-startText follows the reading side.
scale: -1 1 on :dir(rtl)two iconsrtl:-scale-x-100Mirror an arrow that points a way.

Try the direction

The same markup; only lang and dir change.

dir="ltr" · English

Breadcrumbs, switch and a start border

Separators, the switch knob and the start border all turn round.

Paid by card

Angular
<html lang="en" dir="ltr">
  <nav class="ui-breadcrumbs">…</nav>
  <label class="ui-switch">…</label>
</html>

What turns, what does not

Direction-free things keep their shape.

Turns aroundStays as isWhy
Text, padding, bordersLogos and codeCode is always left to right.
Back and next arrowsCheck, clock, playThey do not point a way.
Switch knob, drawersNumbers1042 reads left to right in both.

Rules

  • Never ml-, pr-, left-: they stay put in Arabic.
  • Give a word in the other language its own lang.
  • One kind of digit per product: ar-EG writes ١٠٤٢, ar-EG-u-nu-latn writes 1042.