Skip to content

Commit 484ef5d

Browse files
committed
updated basic documentation
1 parent c7debab commit 484ef5d

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

website/docs/layouts/flex/partials/code/how-to-use.md

+28-7
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,39 @@ A good and quick introduction to flexbox can be found in [**this MDN guide**](ht
88

99
!!!
1010

11-
TODO add intro here about why this component in HDS
11+
The `Layout::Flex` and optional `Layout::Flex::Item` components provide a way to quickly build out flexbox-based layouts of components or elements without needing to write a lot of custom CSS code or understand all the intricacies of CSS flexbox styles.
1212

13-
### Basic usage [TODO]
13+
### Basic usage
1414

15-
Explain the most basic usage here
15+
The simplest way to implementat a flexbox layout is by using the `Layout::Flex` component to wrap some content:
1616

17-
- just flex
18-
- flex + item(s)
17+
```handlebars{data-execute=false}
18+
<Hds::Layout::Flex>
19+
<div>{{! some content here }}</div>
20+
<div>{{! some other content here }}</div>
21+
<div>{{! more content here }}</div>
22+
</Hds::Layout::Flex>
23+
```
24+
25+
In this way, every direct child element of the **flexbox container** will be treated, by the browser's layout engine, as a **flex item** (for details about what this means, refer to the guide linked at the top of this page).
26+
27+
There are cases in which is necessary to wrap one or more child elements in a specific `Layout::Flex::Item` (eg. to apply the `@basis/@grow/@shrink` arguments, see below for details):
28+
29+
```handlebars{data-execute=false}
30+
<Hds::Layout::Flex as |LF|>
31+
<div>{{! some content here }}</div>
32+
<LF.Item @grow={{false}}>
33+
{{! some other content here }}
34+
</LF.Item>
35+
<div>{{! more content here }}</div>
36+
</Hds::Layout::Flex>
37+
```
38+
39+
!!! Info
1940

20-
explain that the `Flex.Item` is not necessary per se
41+
Note: there is no strict need to use the `Layout::Flex::Item` subcomponent as a direct child of `Layout::Flex`; use it only when necessary to tweak flex styles of individual child item via the `@basis/@grow/@shrink` (to avoid rendering an extra Ember component).
2142

22-
add here text about not abusing it!
43+
!!!
2344

2445
### Tag
2546

0 commit comments

Comments
 (0)