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: website/docs/layouts/grid/partials/code/how-to-use.md
+27-5
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ The `Layout::Grid` and optional `Layout::Grid::Item` components provide a way to
12
12
13
13
### Basic usage
14
14
15
-
The parent `Grid` component creates a layout of equal width “columns” by default. Other components and HTML elements can be passed in directly.
15
+
The simplest way to implement a grid layout is by using the `Layout::Grid` component to wrap content directly. A grid layout of equal width “columns” is created by default.
@@ -23,6 +23,28 @@ The parent `Grid` component creates a layout of equal width “columns” by def
23
23
</Hds::Layout::Grid>
24
24
```
25
25
26
+
Every child of the **grid container** will be stretched to fit evenly within the underlying grid column tracks behaving as a **grid item** (for details on what this means, refer to the guide linked at the top of the page).
27
+
28
+
In some cases, it may be necessary to wrap one or more content items within the optional `Layout::Grid::Item` component. i.e., to group content together within a column or row, prevent content from being stretched to fit the underlying grid column width, or to make use of `rowspan` and `colspan` options in order to create more complex layouts. (See below for more details and examples on these features.)
29
+
30
+
### Preventing content stretch
31
+
32
+
```handlebars
33
+
<Hds::Layout::Grid @columnMinWidth="100%" @gap="16" as |LG|>
Note: there is no strict need to use the `Layout::Grid::Item` subcomponent as a direct child of `Layout::Grid`; use it only when necessary to tweak grid styles of individual child item such as via the `@colspan/@rowspan` arguments (to avoid rendering an extra Ember component).
45
+
46
+
!!!
47
+
26
48
### Tag
27
49
28
50
To specify the HTML tag used to render the grid container and/or item(s), use the `@tag` argument:
@@ -185,7 +207,7 @@ Text before the inline grid.
185
207
Text after the inline grid.
186
208
```
187
209
188
-
### Grid::Item
210
+
<!--### Grid::Item
189
211
190
212
Use the `Grid::Item` to wrap content to prevent it from stretching or if more control is needed over the grid layout.
191
213
@@ -199,11 +221,11 @@ Use the `Grid::Item` to wrap content to prevent it from stretching or if more co
Use the `colspan` and `rowspan` options of `Grid::Item`components to set the number of columns or rows an item should occupy.
228
+
Use the `colspan` and `rowspan` options of the `Grid::Item`component to set the number of columns or rows an item should occupy.
207
229
208
230
Note: By default, if a height is set on the `Grid` parent, grid row heights will stretch proportionally to fill the `Grid`. To instead make a row conform to the minimum height of its content, you can pass an inline style as shown in the example.
0 commit comments