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/design/utilities.rst
+27-41Lines changed: 27 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
Utilities
2
-
=========
2
+
#########
3
3
4
4
Introduction
5
-
------------
5
+
************
6
6
7
7
Mautic offers a set of CSS utility classes designed to facilitate efficient implementation of flexible layouts using CSS flex-box. These utilities provide a systematic approach to constructing responsive and dynamic new areas for its User interface, enabling you to rapidly prototype and build complex layouts while minimizing custom CSS.
8
8
@@ -16,47 +16,35 @@ The utility classes seek to encompass a great spectrum of flex-box properties, i
16
16
- Item ordering
17
17
18
18
Key aspects
19
-
^^^^^^^^^^^^
19
+
***********
20
20
21
21
1. **Abbreviated Nomenclature**: class names follow a logical, short and easy-to-remember convention.
22
22
2. **Most Common Uses Coverage**: utilities address the full range of flex-box properties and behaviors.
23
23
3. **Responsive Design**: includes variations for different view port sizes, enabling fine-grained control over layout across devices.
24
-
.. vale off
25
-
26
24
4. **Composability**: you can combine classes to create sophisticated layout patterns.
27
-
28
-
.. vale on
29
-
30
25
5. **Consistent Spacing**: standardized options for managing padding, margin and gap properties.
31
26
32
27
This documentation clearly explains each utility class, its function, and its app. It includes practical examples and best practices for combining utilities to achieve complex layout requirements.
33
28
34
29
The following sections detail the individual utility classes, their usage, and advanced implementation strategies. This resource helps front-end developers efficiently leverage flex-box in their projects.
35
30
36
-
37
31
Abbreviation keys
38
-
----------------
39
-
40
-
.. vale off
41
-
42
-
- **d**: display
43
-
- **fd**: flex-direction
44
-
- **fw**: flex-wrap
45
-
- **jc**: justify-content
46
-
- **ai**: align-items
47
-
- **ac**: align-content
48
-
- **as**: align-self
49
-
- **fg**: flex-grow
50
-
- **fs**: flex-shrink
51
-
- **fb**: flex-basis
52
-
- **fo**: order
53
-
54
-
.. vale on
32
+
=================
33
+
34
+
- **``d``**: display
35
+
- **``fd``**: flex-direction
36
+
- **``fw``**: flex-wrap
37
+
- **``jc``**: justify-content
38
+
- **``ai``**: align-items
39
+
- **``ac``**: align-content
40
+
- **``as``**: align-self
41
+
- **``fg``**: flex-grow
42
+
- **``fs``**: flex-shrink
43
+
- **``fb``**: flex-basis
44
+
- **``fo``**: order
55
45
56
46
Flex container properties
57
-
-------------------------
58
-
59
-
.. vale off
47
+
=========================
60
48
61
49
- ``.d-flex``: Sets an element to be a flex container by setting its display property to flex. It allows the direct children of the element to be laid out in a flex context.
62
50
- ``.fd-row``: Sets the direction of the flex items in the container to a row. The items are laid out from left to right.
@@ -106,8 +94,6 @@ Flex container properties
106
94
- ``.gap-1``: Sets the gap between flex items to 1px.
107
95
- ``.gap-0``: Sets the gap between flex items to 0px.
108
96
109
-
.. vale on
110
-
111
97
Responsive variations
112
98
---------------------
113
99
@@ -128,8 +114,8 @@ For example:
128
114
This approach allows for progressive enhancement of layouts as the view-port size increases, providing fine-grained control over the responsiveness of your design.
129
115
130
116
131
-
Usage examples
132
-
--------------
117
+
Responsive examples
118
+
===================
133
119
134
120
Here are some example scenarios that illustrate how to use these utilities in practice:
135
121
@@ -154,7 +140,7 @@ This example creates a flex container with items spread across the container and
154
140
This example creates a vertical stack of items that stretch to fill the container's width, with a 10px gap between them.
155
141
156
142
Combining utilities
157
-
-------------------
143
+
===================
158
144
159
145
Note that you can combine these utilities to create complex layouts. For example:
160
146
@@ -172,12 +158,12 @@ This combination creates a flex container that:
172
158
- Has a 15px gap between items
173
159
174
160
Padding and margin utilities
175
-
============================
161
+
****************************
176
162
177
163
The CSS utility classes for padding and margin provide a comprehensive set of options for controlling spacing within your layouts. These utilities follow a consistent naming convention and offer a range of predefined sizes, including pixel values and variable-based spacing.
178
164
179
165
Naming convention
180
-
-----------------
166
+
=================
181
167
182
168
The utility classes use the following prefixes:
183
169
@@ -193,7 +179,7 @@ The utility classes use the following prefixes:
193
179
- ``ml-``: margin left
194
180
195
181
Size options
196
-
------------
182
+
============
197
183
198
184
The utilities offer the following size options:
199
185
@@ -205,8 +191,8 @@ The utilities offer the following size options:
205
191
206
192
.. vale on
207
193
208
-
Usage examples
209
-
--------------
194
+
Padding and margin examples
195
+
===========================
210
196
211
197
.. code-block:: html
212
198
@@ -217,13 +203,13 @@ Usage examples
217
203
<divclass="mt-32 mb-32">Margin 32px on top and bottom</div>
218
204
219
205
Variable-based sizes
220
-
--------------------
206
+
====================
221
207
222
208
Some utilities use CSS variables for spacing, allowing for easy theming and consistent spacing across your app:
223
209
224
210
- ``var(--spacing-03)`` to ``var(--spacing-13)``
225
211
226
-
These correspond to specific pixel values (for example, ``var(--spacing-03)`` is 8px, ``var(--spacing-13)`` is 160px).
212
+
These correspond to specific pixel values - for example, ``var(--spacing-03)`` is 8px, ``var(--spacing-13)`` is 160px.
227
213
228
214
.. note::
229
215
All padding and margin utilities use the ``!important`` declaration to ensure they take precedence over other styles. Use these utilities judiciously to maintain the integrity of your CSS architecture.
0 commit comments