## Component Description

The Nessie layout system doesn’t restrict you to a single grid with _x_ columns.
Instead you have the power to define any grid you like, with 4 possible gutter
sizes (or no gutters at all).

What’s more, you’re free to define _multiple_ grids and sub-grids which you can
mix and match as you see fit. (With great power comes great responsibility.
We urge you to exercise restraint.)

You can use **GridItem** component if you need to extend features of Grid to a
specific grid cell(s).

### Setting up a Grid

In order to use Grid, you **don't** need to rely on Rows and Columns anymore,
because Grid component is using `display: grid;` and almost everything is
defined on container level, while everything inside is grid item and is placed
inside grid cells according to rules from container (Grid itself).

A simple example:

```
<Grid columns={3}>
    <Label>...</Label>
    <TextInput>...</TextInput>
    <Button>...</Button>
</Grid>
```

The result is:

```
+---[ Grid ]---------------------------------------------------------+
|  +----[ Label ]-----+  +--[ TextInput ]---+  +---[ Button ]-----+  |
|  |                  |  |                  |  |                  |  |
|  +------------------+  +------------------+  +------------------+  |
+--------------------------------------------------------------------+
```

Notice how, no matter which element is placed inside of Grid, all elements
occupy the same amount of space inside of it. This is because Grid by default
is giving each item the same size (`1fr`, or 1 fraction of free space) and
spaces them evenly.

### Difference between implicit and explicit grids

**Explicit grid** is manually defined grid that is formed by defining a fixed
number of lines and tracks. In order to set explicit grid, use `columns` and
`rows` props. It's not obligatory to define an explicit grid.

If there are more grid items than cells in the grid or when a grid item is
placed outside of the explicit grid, the grid container automatically generates
grid tracks by adding grid lines to the grid. The explicit grid together with
these additional implicit tracks and lines forms the so called
**implicit grid**. Use `autoColumns` and `autoRows` props to define the grid
cell sizes of implicit grid.

### Columns and rows

You can simply set the number of `columns` and/or `rows` that you want. This
way, you can have an explicit grid (e.g. 6x3) with all grid cells of the same
size (`1fr`).

The number should be an integer greater than 0 (zero).

If you need more specific grid, you can specify a templates for the the
`templateColumns` and `templateRows` props in the form of a list of CSS size
values.

All props are accepting string values, so you can define your grid however you
want, e.g.:

- `"100px 1fr auto 200px"` (creates a grid with 4 columns)
- `"1fr 3fr 50%"` (creates a grid with 3 columns)
- `"repeat(7, 1fr)"` (creates a grid with 7 equally wide columns)
- etc.

### Grid flow

With `autoFlow`, you can choose where the new items will be placed if you have
grid items that you don't explicitly place on the grid - the auto-placement
algorithm automatically places the items in the Grid. This property controls how
the auto-placement algorithm works.

The prop accepts one of two values:

- `"row"` - tells the auto-placement algorithm to fill in each row in turn,
  adding new rows as necessary (default)
- `"column"` - tells the auto-placement algorithm to fill in each column in turn,
  adding new columns as necessary

### Grid gaps

`gap` is used for defining a space between columns and rows.

The props accept one of four values: `"s"`, `"m"` (default), `"l"` and `"none"`
(no gaps).

If you pass a tuple (e.g `["s", "m"]`) the first value will be used as the row
gap and the second as the column gap.

#### Grid content alignment

##### Inline-axis alignment

The Grid’s `justifyContent` prop accepts one of four values: `"stretch"`,
`"start"`, `"end"` and `"center"`.

Aligns the grid content along the inline (usually horizontal) axis.

##### Block-axis alignment

The Grid’s `alignContent` prop accepts one of four values: `"stretch"`,
`"start"`, `"center"` and `"end"`.

Aligns the grid content along the block (usually vertical) axis.

#### Grid item alignment

##### Inline-axis alignment

The Grid’s `justifyItems` prop accepts one of four values: `"stretch"`,
`"start"`, `"end"` and `"center"`.

Aligns grid items along the inline (usually horizontal) axis. This value applies
to all grid items inside the container.

##### Block-axis alignment

The Grid’s `alignItems` prop accepts one of four values: `"stretch"`, `"start"`,
`"center"` and `"end"`.

Aligns grid items along the block (usually vertical) axis. This value applies to
all grid items inside the container.
