Skip to content

Commit 66cdc4e

Browse files
committed
docs: update documentation
1 parent e3f247f commit 66cdc4e

File tree

2 files changed

+10
-67
lines changed

2 files changed

+10
-67
lines changed

docs/content/4.0/getting-started/rtl.md

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ We recommend getting familiar with CoreUI for Bootstrap first by reading through
1212

1313
You may also want to read up on [the RTLCSS project](https://rtlcss.com/), as it powers our approach to RTL.
1414

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-
2115
## Required HTML
2216

2317
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
6761

6862
## Approach
6963

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:
7165

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.
7367

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.
7569

7670
For example, instead of `.ml-3` for `margin-left`, use `.ms-3`.
7771

7872
Working with RTL, through our source Sass or compiled CSS, shouldn't be much different from our default LTR though.
7973

8074
## Customize from source
8175

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
10778
10879
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.
10980
@@ -130,47 +101,19 @@ $font-family-sans-serif:
130101
sans-serif,
131102
// Emoji fonts
132103
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default;
133-
```
104+
``` -->
134105

135106
### LTR and RTL at the same time
136107

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:
138109

139110
```scss
140-
/* rtl:begin:options: {
141-
"autoRename": true,
142-
"stringMap":[
143-
"name": "ltr-rtl",
144-
"priority": 100,
145-
"search": ["ltr"],
146-
"replace": ["rtl"],
147-
"options": {
148-
"scope": "*",
149-
"ignoreCase": false
150-
}
151-
]
152-
} */
153-
.ltr {
154-
@import "../node_modules/bootstrap/scss/bootstrap";
155-
}
156-
/*rtl:end:options*/
111+
$enable-ltr: true;
112+
$enable-rtl: true;
157113
```
158114

159115
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.
160116

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`.
174117

175118
## Additional resources
176119

docs/layouts/partials/sidebar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</a>
2727

2828
{{- if $group.pages }}
29-
<ul class="nav-group-items sidebar-nav-sm">
29+
<ul class="nav-group-items compact">
3030
{{- range $doc := $group.pages -}}
3131
{{- $doc_slug := $doc.title | urlize -}}
3232
{{- $is_active := and $is_active_group (eq $page_slug $doc_slug) -}}

0 commit comments

Comments
 (0)