Skip to content

feat: Add RTL/LTR support with one-click toggle#38

Open
rafaumeu wants to merge 1 commit into
TailAdmin:mainfrom
rafaumeu:feat/rtl-support
Open

feat: Add RTL/LTR support with one-click toggle#38
rafaumeu wants to merge 1 commit into
TailAdmin:mainfrom
rafaumeu:feat/rtl-support

Conversation

@rafaumeu

Copy link
Copy Markdown

Overview

This PR adds full Right-to-Left (RTL) language support to TailAdmin, addressing issue #27.

Changes

RTL Toggle Button

  • Added an RTL/LTR toggle button in the header next to the Dark Mode toggle
  • Uses Alpine.js to manage the rtl state, persisted in localStorage (same pattern as existing Dark Mode toggle)
  • Sets dir="rtl" or dir="ltr" on the <html> element via x-init and ``

Tailwind v4 Logical Properties

  • Converted directional utility classes to logical properties across all partials:
    • ml- / mr-ms- / me- (margin-inline-start/end)
    • pl-ps- (padding-inline-start)
    • left- / right-start- / end- (inset-inline-start/end)
  • These flip automatically based on the dir attribute

Sidebar

  • Sidebar slide animation direction flips with RTL (translate-x-full vs -translate-x-full)
  • Border direction adapted (border-rrtl:border-l)

Notification Dropdown

  • Position uses ltr: and rtl: variant prefixes for correct alignment

Documentation

  • Added "RTL Support" section to README explaining how it works and how to toggle programmatically

Pages Modified

All 17 HTML pages + partials (header, sidebar, etc.)

Testing

  • npm run build passes without errors
  • Verified compiled CSS contains [dir="rtl"] and [dir="ltr"] selectors (8 each)
  • Ran npm run sort (Prettier) for consistent formatting

Closes #27

- Add RTL/LTR toggle button in header (Alpine.js + localStorage)
- Add 'rtl' state to x-data across all 17 HTML pages
- Set dir attribute on <html> via x-init +
- Convert directional classes to Tailwind v4 logical properties
  (ml-/mr- -> ms-/me-, pl- -> ps-, left/right -> start/end)
- Sidebar: translate-x direction flips based on rtl state
- Notification dropdown: ltr:/rtl: variant prefixes for positioning
- Add RTL documentation section to README
- Run prettier (npm run sort) for consistent formatting

Closes TailAdmin#27
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.

Does TailAdmin support RTL (Right-to-Left) languages?

1 participant