# Grid ### Install ```js import { createApp } from 'vue'; import { Grid, GridItem } from 'vant'; const app = createApp(); app.use(Grid); app.use(GridItem); ``` ## Usage ### Basic Usage ```html ``` ### Column Num ```html ``` ### Custom Content ```html ``` ### Square ```html ``` ### Gutter ```html ``` ### Horizontal ```html ``` ### Route ```html ``` ### Show Badge ```html ``` ## API ### Grid Props | Attribute | Description | Type | Default | | --- | --- | --- | --- | | column-num | Column Num | _number \| string_ | `4` | | icon-size | Icon size | _number \| string_ | `28px` | | gutter | Gutter | _number \| string_ | `0` | | border | Whether to show border | _boolean_ | `true` | | center | Whether to center content | _boolean_ | `true` | | square | Whether to be square shape | _boolean_ | `false` | | clickable | Whether to show click feedback when clicked | _boolean_ | `false` | | direction | Content arrangement direction, can be set to `horizontal` | _string_ | `vertical` | ### GridItem Props | Attribute | Description | Type | Default | | --- | --- | --- | --- | | text | Text | _string_ | - | | icon | Icon name or URL | _string_ | - | | icon-prefix | Icon className prefix | _string_ | `van-icon` | | dot | Whether to show red dot | _boolean_ | `false` | | badge | Content of the badge | _number \| string_ | - | | url | Link URL | _string_ | - | | to | Target route of the link, same as to of vue-router | _string \| object_ | - | | replace | If true, the navigation will not leave a history record | _boolean_ | `false` | ### GridItem Events | Event | Description | Arguments | | ----- | --------------------------------- | ------------------- | | click | Emitted when component is clicked | _event: MouseEvent_ | ### GridItem Slots | Name | Description | | ------- | -------------- | | default | Custom content | | icon | Custom icon | | text | Custom text | ### Less Variables How to use: [Custom Theme](#/en-US/theme). | Name | Default Value | Description | | --- | --- | --- | | @grid-item-content-padding | `@padding-md @padding-xs` | - | | @grid-item-content-background-color | `@white` | - | | @grid-item-content-active-color | `@active-color` | - | | @grid-item-icon-size | `28px` | - | | @grid-item-text-color | `@gray-7` | - | | @grid-item-text-font-size | `@font-size-sm` | - |