Skip to content

Commit 57e09c3

Browse files
authored
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.
1 parent eee9527 commit 57e09c3

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

docs/extend/theme.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,40 @@ All this will do is show your extension in the "theme" section in the admin dash
2323

2424
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.
2525

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+
2660
## Switching Between Themes
2761

2862
Flarum doesn't currently have a comprehensive system that would support switching between themes. This is planned for future releases.

0 commit comments

Comments
 (0)