You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/4.0/getting-started/rtl.md
+9-66Lines changed: 9 additions & 66 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,12 +12,6 @@ We recommend getting familiar with CoreUI for Bootstrap first by reading through
12
12
13
13
You may also want to read up on [the RTLCSS project](https://rtlcss.com/), as it powers our approach to RTL.
14
14
15
-
{{< callout warning >}}
16
-
### Experimental feature
17
-
18
-
The RTL feature is still **experimental** and will probably evolve according to user feedback. Spotted something or have an improvement to suggest? [Open an issue]({{< param repo >}}/issues/new), we'd love to get your insights.
19
-
{{< /callout >}}
20
-
21
15
## Required HTML
22
16
23
17
There are two strict requirements for enabling RTL in Bootstrap-powered pages.
@@ -67,43 +61,20 @@ You can see the above requirements reflected in this modified RTL starter templa
67
61
68
62
## Approach
69
63
70
-
Our approach to building RTL support into CoreUI for Bootstrap comes with two important decisions that impact how we write and use our CSS:
64
+
Our approach to building RTL support into CoreUI comes with two important decisions that impact how we write and use our CSS:
71
65
72
-
1.**First, we decided to build it with the [RTLCSS](https://rtlcss.com/) project.** This gives us some powerful features for managing changes and overrides when moving from LTR to RTL. It also allows us to build two versions of CoreUI for Bootstrap from one codebase.
66
+
1.**First, as in CoreUI 3 we decided to build it with our own mixins** This gives us full control and allows us to generate LTR and RTL separately, or if needed one stylesheet with both versions without any style's duplicates.
73
67
74
-
2.**Second, we've renamed a handful of directional classes to adopt a logical properties approach.** Most of you have already interacted with logical properties thanks to our flex utilities—they replace direction properties like `left` and `right` in favor `start` and `end`. That makes the class names and values appropriate for LTR and RTL without any overhead.
68
+
2.**Second, in CoreUI 3 we introduced a handful of directional classes ex. `mfs-auto`, but in CoreUI 4 we've simplified them ex. `ms-auto`, and renamed all directional classes to adopt a logical properties approach.** Most of you have already interacted with logical properties thanks to our flex utilities—they replace direction properties like `left` and `right` in favor `start` and `end`. That makes the class names and values appropriate for LTR and RTL without any overhead.
75
69
76
70
For example, instead of `.ml-3` for `margin-left`, use `.ms-3`.
77
71
78
72
Working with RTL, through our source Sass or compiled CSS, shouldn't be much different from our default LTR though.
79
73
80
74
## Customize from source
81
75
82
-
When it comes to [customization]({{< docsref "/customize/sass" >}}), the preferred way is to take advantage of variables, maps, and mixins. This approach works the same for RTL, even if it's post-processed from the compiled files, thanks to [how RTLCSS works](https://rtlcss.com/learn/getting-started/why-rtlcss/).
83
-
84
-
### Custom RTL values
85
-
86
-
Using [RTLCSS value directives](https://rtlcss.com/learn/usage-guide/value-directives/), you can make a variable output a different value for RTL. For example, to decrease the weight for `$font-weight-bold` throughout the codebase, you may use the `/*rtl: {value}*/` syntax:
87
-
88
-
```scss
89
-
$font-weight-bold: 700#{/*rtl:600 */}!default;
90
-
```
91
-
92
-
Which would ouput to the following for our default CSS and RTL CSS:
93
-
94
-
```css
95
-
/* coreui.css */
96
-
dt {
97
-
font-weight: 700/* rtl:600 */;
98
-
}
99
-
100
-
/* coreui.rtl.css */
101
-
dt {
102
-
font-weight: 600;
103
-
}
104
-
```
105
-
106
-
### Alternative font stack
76
+
When it comes to [customization]({{< docsref "/customize/sass" >}}), the preferred way is to take advantage of variables, maps, and mixins.
77
+
<!-- TODO: find solution ### Alternative font stack
107
78
108
79
In the case you're using a custom font, be aware that not all fonts support the non-Latin alphabet. To switch from Pan-European to Arabic family, you may need to use `/*rtl:insert: {value}*/` in your font stack to modify the names of font families.
109
80
@@ -130,47 +101,19 @@ $font-family-sans-serif:
130
101
sans-serif,
131
102
// Emoji fonts
132
103
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default;
133
-
```
104
+
```-->
134
105
135
106
### LTR and RTL at the same time
136
107
137
-
Need both LTR and RTL on the same page? Thanks to [RTLCSS String Maps](https://rtlcss.com/learn/usage-guide/string-map/), this is pretty straightforward. Wrap your `@import`s with a class, and set a custom rename rule for RTLCSS:
108
+
Need both LTR and RTL on the same page? All you have to do is set following variables:
After running Sass then RTLCSS, each selector in your CSS files will be prepended by `.ltr`, and `.rtl` for RTL files. Now you're able to use both files on the same page, and simply use `.ltr` or `.rtl` on your components wrappers to use one or the other direction.
160
116
161
-
{{< callout warning >}}
162
-
#### Edge cases and known limitations
163
-
164
-
While this approach is understandable, please pay attention to the following:
165
-
166
-
1. When switching `.ltr` and `.rtl`, make sure you add `dir` and `lang` attributes accordingly.
167
-
2. Loading both files can be a real performance bottleneck: consider some [optimization]({{< docsref "/customize/optimize" >}}), and maybe try to [load one of those files asynchronously](https://www.filamentgroup.com/lab/load-css-simpler/).
168
-
3. Nesting styles this way will prevent our `form-validation-state()` mixin from working as intended, thus require you tweak it a bit by yourself. [See #31223](https://github.com/twbs/bootstrap/issues/31223).
169
-
{{< /callout >}}
170
-
171
-
## The breadcrumb case
172
-
173
-
The [breadcrumb separator]({{< docsref "/components/breadcrumb" >}}/#changing-the-separator) is the only case requiring its own brand new variable— namely `$breadcrumb-divider-flipped` —defaulting to `$breadcrumb-divider`.
0 commit comments