feat: add native RTL/LTR support via CSS logical properties by hawraz93 · Pull Request #1146 · wireui/wireui · GitHub
Skip to content

feat: add native RTL/LTR support via CSS logical properties - #1146

Open
hawraz93 wants to merge 8 commits into
wireui:mainfrom
hawraz93:feature/rtl-ltr-support
Open

hawraz93 wants to merge 8 commits into
wireui:mainfrom
hawraz93:feature/rtl-ltr-support

Conversation

@hawraz93

Copy link
Copy Markdown

Summary

This PR adds native RTL/LTR support to WireUI by replacing fixed
directional spacing classes (ml-, mr-, pl-, pr-) with
Tailwind CSS logical properties (ms-, me-, ps-, pe-).

Setting dir="rtl" on the HTML element is now enough for all
components to flip automatically — no extra CSS needed.

Affected Components

  • Alert
  • DatetimePicker
  • Dialog
  • Dropdown (base, header, item)
  • Notifications
  • Popover
  • Select
  • TextField (password, textarea)
  • TimePicker (picker, selector)
  • Wrapper / TextField

Why Logical Properties?

Tailwind's logical properties are the recommended way to handle
bidirectional layouts. They respect the document's writing direction
without needing separate RTL stylesheets or JavaScript overrides.

Testing

Tested with dir="rtl" on Kurdish, Arabic, and Persian layouts.

Replace all directional Tailwind utilities with CSS logical property
equivalents, enabling automatic RTL and LTR layout support based on
the HTML dir attribute.

Changes:
- pl-*/pr-* → ps-*/pe-* (padding-inline-start/end)
- ml-*/mr-* → ms-*/me-* (margin-inline-start/end)
- left-0/right-0 → start-0/end-0 (inset-inline-start/end)
- text-left/text-right → text-start/text-end
- border-l/border-r → border-s/border-e
- rounded-tr/rounded-br → rounded-se/rounded-ee (border-start/end-end-radius)
- ml-auto → ms-auto

Files changed (14):
  Alert, DatetimePicker, Dialog, Dropdown (base/header/item),
  Notifications, Popover, Select, TextField (password/textarea),
  TimePicker (picker/selector), Wrapper/text-field

Requires Tailwind CSS v3.3+ or v4 for logical property support.
Usage: set dir=rtl or dir=ltr on <html> element.
Replace directional spacing classes (ml-, mr-, pl-, pr-) with Tailwind
CSS logical properties (ms-, me-, ps-, pe-) across all components so
layouts flip automatically when dir=rtl is set on the HTML element.

Affected components:
- Alert
- DatetimePicker
- Dialog
- Dropdown (base, header, item)
- Notifications
- Popover
- Select
- TextField (password, textarea)
- TimePicker (picker, selector)
- Wrapper/TextField

Also adds RTL/LTR support documentation section to README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant