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
Document layout breakpoints and container width custom properties (#567)
Companion to flarum/framework#4869, which completes the wide-screen
breakpoint bands for the main layout and exposes the per-band container
widths (and the discussion prose cap) as CSS custom properties.
Copy file name to clipboardExpand all lines: docs/extend/theme.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,40 @@ All this will do is show your extension in the "theme" section in the admin dash
23
23
24
24
You can define new Less variables in your extension's Less files. There currently isn't an extender to modify Less variable values in the PHP layer, but this is planned for future releases.
25
25
26
+
## Layout Widths and Breakpoints
27
+
28
+
Flarum's layout uses a fixed-width `.container` that steps through breakpoint bands. The bands are available as Less variables for use in `@media` queries:
29
+
30
+
| Variable | Applies |
31
+
| --- | --- |
32
+
|`@phone`| below 768px |
33
+
|`@tablet`| 768–991px |
34
+
|`@desktop`| 992–1099px |
35
+
|`@desktop-hd`| 1100px and up |
36
+
|`@desktop-xl`| 1600px and up |
37
+
|`@desktop-xxl`| 2000px and up |
38
+
|`@desktop-xxxl`| 3000px and up |
39
+
40
+
(There are also `@tablet-up` and `@desktop-up` shorthands.)
41
+
42
+
The container's width in each desktop band is a CSS custom property, so a theme can retune any band from `:root` without re-declaring the media queries:
43
+
44
+
```less
45
+
:root {
46
+
--container-hd: 1240px; // 1100px and up
47
+
--container-xl: 1440px; // 1600px and up
48
+
--container-xxl: 1800px; // 2000px and up
49
+
}
50
+
```
51
+
52
+
Independently of the container, the discussion post stream is capped on wide screens so text lines stay a readable length. Themes can adjust or disable that cap:
53
+
54
+
```less
55
+
:root {
56
+
--discussion-content-max-width: 900px; // or `none` to let prose fill the container
57
+
}
58
+
```
59
+
26
60
## Switching Between Themes
27
61
28
62
Flarum doesn't currently have a comprehensive system that would support switching between themes. This is planned for future releases.
0 commit comments