PHPackages                             swissup/module-rtl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. swissup/module-rtl

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

swissup/module-rtl
==================

Magento2 RTL detection

1.3.10(1y ago)4441.0k—7.9%33MITPHP

Since Mar 26Pushed 1y ago7 watchersCompare

[ Source](https://github.com/swissup/module-rtl)[ Packagist](https://packagist.org/packages/swissup/module-rtl)[ RSS](/packages/swissup-module-rtl/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (15)Used By (3)

Magento RTL
===========

[](#magento-rtl)

Magento module that helps to add RTL support to your modules and themes.

Installation
------------

[](#installation)

```
composer require swissup/module-rtl
bin/magento module:enable Swissup_Rtl
```

Usage
-----

[](#usage)

### CSS class

[](#css-class)

Module automatically adds `rtl` class name to the body element when current language is detected as RTL. This allows you to write plain RTL-specific styles in your css/less files:

```
.my-element {
    right: 20px;
}
.rtl .my-element {
    right: auto;
    left: 20px;
}
```

While this approach is nice for the small files, it becomes a headache when dealing with large portion of css that should be adjusted. Additionally, this approach make your style files larger.

We recommend to use [LESS mixins](#less-mixins) for the best experience.

### LESS mixins

[](#less-mixins)

This approach allows to keep minimal size of generated CSS file:

```
@import 'Swissup_Rtl::css/_modrtl.less';

.sidebar-popup {
    .left(0);
    .modrtl(transform, ~"translateX(-100%)", ~"translateX(100%)");

    &.shown {
        transform: translateX(0);
    }

    .close {
        .right(0);
    }
}
```

Additionally, you can use `@modrtl-dir` variable in `& when` statements:

```
@import 'Swissup_Rtl::css/_modrtl.less';

& when (@modrtl-dir = rtl) {
    .my-element {
        right: auto;
        left: 20px;
    }
}
```

**Mixins list**

MixinExample**Misc**.modrtl(@property, @ltrValue, @rtlValue).modrtl(display, block, inline).direction().direction() // will output current direction.direction(@value).direction(rtl).background-position(@ltrValue, @rtlValue).background-position(100% 50%, 0 50%).text-align(@direction).text-align(left)**Padding**.padding(@value).padding(10px 25px 10px 5px).padding-left(@value).padding-left(5px).padding-right(@value).padding-right(25px)**Margin**.margin(@value).margin(10px 25px 10px 5px).margin-left(@value).margin-left(5px).margin-right(@value).margin-right(25px)**Positioning**.float(@direction).float(left).clear(@direction).clear(left).left(@distance).left(20px).right(@distance).right(20px)**Border**.border-radius(@value).border-radius(5px 0 0 5px).border-\[top|right|bottom|left\]-radius(@radius).border-top-radius(5px).border-\[top|bottom\]-\[left|right\]-radius(@radius).border-top-left-radius(5px).border-left(@border-style).border-left(1px solid #f4f4f4);.border-right(@border-style).border-right(1px solid #f4f4f4);.border-color(@value).border-color(#f4f4f4 transparent #eee #f4f4f4).border-left-color(@color).border-left-color(#f4f4f4).border-right-color(@color).border-right-color(transparent).border-style(@value).border-style(dotted dashed none solid).border-left-style(@style).border-left-style(solid).border-right-style(@style).border-right-style(none).border-width(@value).border-width(1px 0 1px 2px).border-left-width(@width).border-left-width(0).border-right-width(@width).border-right-width(2px)### PHP helper

[](#php-helper)

```
class Example
{
    public function __construct(\Swissup\Rtl\Helper\Data $rtlHelper)
    {
        // Check current locale
        $rtlHelper->isRtl();

        // Check locale code
        $rtlHelper->isRtl('en_US');
    }
}
```

License
-------

[](#license)

Distributed under the [MIT license](http://opensource.org/licenses/MIT)

Credits
-------

[](#credits)

Mixins are taken from [anasnakawa/bi-app-sass](https://github.com/anasnakawa/bi-app-sass). Thanks!

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance46

Moderate activity, may be stable

Popularity41

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 70.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~197 days

Recently: every ~189 days

Total

14

Last Release

404d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1108bccc259ec1b0fc93f04a182965faf1213460894ee297f1acf3482e3296ac?d=identicon)[vovayatsyuk](/maintainers/vovayatsyuk)

![](https://www.gravatar.com/avatar/33aea824c2948821ee367ad65fab9d355c71d86ce4ff021a40882a410f14ef94?d=identicon)[swissup](/maintainers/swissup)

---

Top Contributors

[![vovayatsyuk](https://avatars.githubusercontent.com/u/306080?v=4)](https://github.com/vovayatsyuk "vovayatsyuk (33 commits)")[![ci-swissuplabs](https://avatars.githubusercontent.com/u/40459861?v=4)](https://github.com/ci-swissuplabs "ci-swissuplabs (12 commits)")[![roma84](https://avatars.githubusercontent.com/u/2668851?v=4)](https://github.com/roma84 "roma84 (2 commits)")

---

Tags

magento2-modulemagento2-rtlrtlrtl

### Embed Badge

![Health badge](/badges/swissup-module-rtl/health.svg)

```
[![Health](https://phpackages.com/badges/swissup-module-rtl/health.svg)](https://phpackages.com/packages/swissup-module-rtl)
```

###  Alternatives

[rmrevin/yii2-comments

Comments module for Yii2

5130.8k](/packages/rmrevin-yii2-comments)[easyswoole/verifycode

21102.4k4](/packages/easyswoole-verifycode)[jolicode/seo-override

Override your seo markup on the fly

1462.4k](/packages/jolicode-seo-override)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
