JGuang

Grid

Grid · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

Grid

Used for navigation of multiple sub-functions in the business.

Install

npm install antd-mobile@5.43.0

antd-mobile is for mobile web, not React Native or Mini Programs. React 19 projects must register createRoot with unstableSetRender at the entry, or imperative APIs such as Toast and Dialog cannot render. Switch dark mode with <html data-prefers-color-scheme="dark">.

Examples come from the official Ant Design Mobile repository (MIT) at the commit published as npm 5.43.0. Presentation helpers such as DemoBlock are JGuang rewrites, not antd-mobile APIs.

Used for navigation of multiple sub-functions in the business.

When to Use

It is used as a function entry in pages with strong recommendation properties, such as the home page.

Demos

Grid

Props

NameDescriptionTypeDefault
columnsThe number of columnsnumber-
gapSpacing between gridsnumber | string | [number | string, number | string]0

CSS Variables

NameDescriptionDefaultGlobal
--gapThe gap between items.0-
--gap-horizontalThe horizontal gap between items.var(--gap)-
--gap-verticalThe vertical gap between items.var(--gap)-

Grid.Item

Props

NameDescriptionTypeDefault
onClickThe click event.(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void-
spanSpannumber1

FAQ

The Grid component uses the CSS Grid feature, so the compatibility standard is iOS Safari >= 10.3 and Chrome >= 57.