Reputation: 3371
How can I change only the title font but retain the default font for the child of the Card component of Ant Design?
Sample Card component:
// How to change title style
<Card title="Default" extra={<a href="#">More</a>} style={{ width: 300 }}>
<p>Card content</p>
<p>Card content</p>
<p>Card content</p>
</Card>
Upvotes: 3
Views: 10366
Reputation: 53964
title
property of Card
accepts ReactNode
, therefore you can render any react component in particular its style:
import { Card, Typography } from 'antd';
const { Title } = Typography;
const App = () => (
<Card title={<Title level={2}>Custom Title</Title>}>
<p>Card Content</p>
</Card>
);
title
- Card title -string|ReactNode
Upvotes: 5