@sass-collective/direction
v4.0.1
Published
Manage content direction for languages right-to-left or left-to-right rules.
Downloads
168
Maintainers
Readme
Introduction
Manage content direction for languages right-to-left
or left-to-right
rules.
Installing
npm install @sass-collective/direction
Usage
@use "@sass-collective/direction";
Tokens
| Key | Description |
|-------|-----------------------------------------------|
| rtl
| Sets CSS rules for right-to-left
direction. |
| ltr
| Sets CSS rules for left-to-right
direction. |
API
Sass mixins
| Mixin | Description |
|--------------------------------------|-------------------------------------------------------------------------------------------|
| styles($direction, $root-selector)
| Sets direction rule with optional $root-selector
option. Default $direction
is rtl
. |
Add direction rule with direction.styles()
The following Sass...
@use "@sass-collective/direction";
.foo {
@include direction.styles {
margin-left: 0;
margin-right: 20px;
}
@include direction.styles(ltr) {
margin-left: 20px;
margin-right: 0;
}
@include direction.styles($root-selector:. bar) {
margin-left: 0;
margin-right: 20px;
}
}
...will produce the following CSS...
[dir="rtl"] .foo {
margin-left: 0;
margin-right: 20px;
}
[dir="ltr"] .foo {
margin-left: 20px;
margin-right: 0;
}
[dir="rtl"] .bar .foo {
margin-left: 0;
margin-right: 20px;
}