Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 0963d3f

Browse files
committed
Update docs
1 parent be1e5a9 commit 0963d3f

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

website/pages/grid.mdx

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import SEO from "../components/SEO";
1+
import SEO from '../components/SEO'
22

33
<SEO
44
title="Grid"
@@ -15,10 +15,9 @@ comes with helpful style shorthand. It renders a `div` element.
1515
## Import
1616

1717
```js
18-
import { CGrid } from "@chakra-ui/vue";
18+
import { CGrid, CGridItem } from '@chakra-ui/vue'
1919
```
2020

21-
2221
## Usage
2322

2423
Using the `Grid` component, here are some helpful shorthand props:
@@ -51,6 +50,43 @@ time.
5150
</c-grid>
5251
```
5352

53+
## Spanning Columns
54+
55+
In some layouts, you may need certain grid items to span specific amount of columns or rows instead of an even distribution. To achieve this, you need to pass the `colSpan` prop to the `CGridItem` component to span across columns and also pass the `rowSpan` component to span across rows. You also need to specify the `templateColumns` and `templateRows`.
56+
57+
```vue live=true
58+
<c-grid w="600px" template-columns="repeat(5, 1fr)" gap="6">
59+
<c-grid-item row-span="2" col-span="1" bg="blue.300"" />
60+
<c-grid-item col-span="2" bg="red.300" />
61+
<c-grid-item col-span="2" bg="red.300" />
62+
<c-grid-item col-span="4" bg="blue.300" />
63+
</c-grid>
64+
```
65+
66+
## Starting and Ending Lines
67+
68+
Pass the `colStart` and `colEnd` prop to `CGridItem` component to make an element start or end at the `nth` grid position.
69+
70+
```vue live=true
71+
<c-grid w="600px" template-columns="repeat(5, 1fr)" gap="6">
72+
<c-grid-item col-span="2" h="10" bg="blue.500" />
73+
<c-grid-item col-start="4" col-end="6" h="10" bg="red.500" />
74+
</c-grid>
75+
```
76+
5477
## Props
5578

56-
> `CGrid` composes the `CBox` component. So it accepts all Box props along with the related CSS grid props. See [Box](/box#props) component for list of props
79+
> `CGrid` composes the `CBox` component. So it accepts all Box props along with the related CSS grid props. See [Box](/box#props) component for list of props
80+
81+
### `CGridItem` Props
82+
83+
> `CGridItem` composes `CBox` so you can pass all `CBox` props.
84+
85+
| Name | Type | Description |
86+
| -------- | -------- | ------------------------------------------------ |
87+
| colSpan | `number` | The number of columns the grid item should span. |
88+
| colStart | `number` | The column number the grid item should start. |
89+
| colEnd | `number` | The column number the grid item should end. |
90+
| rowSpan | `number` | The number of rows the grid item should span. |
91+
| rowStart | `number` | The row number the grid item should start. |
92+
| rowEnd | `number` | The row number the grid item should end. |

0 commit comments

Comments
 (0)