CardHeader 是 WordPress 组件库中的一个 React 组件,用于在 Card 内渲染可选头部。它继承 Card 的上下文属性,支持自定义边框、背景和内边距。
import { Card, CardHeader } from '@wordpress/components';
const Example = () => (
<Card>
<CardHeader>...</CardHeader>
<CardBody>...</CardBody>
</Card>
);CardHeader renders an optional header within a Card.
import { Card, CardHeader } from '@wordpress/components';
const Example = () => (
<Card>
<CardHeader>...</CardHeader>
<CardBody>...</CardBody>
</Card>
);
Note: This component is connected to Card‘s Context. The value of the size and isBorderless props is derived from the Card parent component (if there is one). Setting these props directly on this component will override any derived values.
isBorderless: booleanRenders without a border.
falseisShady: booleanRenders with a light gray background color.
falsesize: string | objectDetermines the amount of padding within the component. Can be specified either as a single size token or as an object.
mediumnone, xSmall, small, medium, large{
blockStart: 'none' | 'xSmall' | 'small' | 'medium' | 'large';
blockEnd: 'none' | 'xSmall' | 'small' | 'medium' | 'large';
inlineStart: 'none' | 'xSmall' | 'small' | 'medium' | 'large';
inlineEnd: 'none' | 'xSmall' | 'small' | 'medium' | 'large';
}