JGuang

Card

Card · Ant Design Mobile

Preview
npm install antd-mobile@5.43.0

Card

Universal card container.

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.

Universal card container.

When to Use

It can carry text, lists, pictures, paragraphs, etc., which is convenient for users to browse the content.

Demos

Card

Props

NameDescriptionTypeDefaultVersion
bodyClassNameThe custom class name of the bodystring-
bodyStyleThe custom style of the bodyReact.CSSProperties-
extraThe right area of the headerReactNode-
headerClassNameThe custom class name of the headerstring-
headerStyleThe custom style of the headerReact.CSSProperties-
iconThe left icon of the headerReactNode-5.38.0
onBodyClickThe click event of the body area(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void-
onClickThe click event of the Card(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void-
onHeaderClickThe click event of the header area(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void-
titleThe left area of the headerReactNode-

CSS Variables

NameDescriptionDefaultGlobalVersion
--adm-card-border-radiusBorder radius of the button.8px--adm-card-border-radius
--adm-card-padding-inlineHorizontal padding of the card.12px--adm-card-padding-inline
--adm-card-header-border-widthBottom border width of the card header.0.5px--adm-card-header-border-width
--adm-card-header-border-colorBottom border color of the card header.var(--adm-color-border)--adm-card-header-border-color
--adm-card-header-gapHorizontal gap of the card header.8px--adm-card-header-gap5.38.0
--adm-card-header-padding-blockVertical of the card header.12px--adm-card-header-padding-block
--adm-card-body-padding-blockVertical padding of the card body.12px--adm-card-body-padding-block