Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

362
Visualizações
How to customize the title of a card in antd

in a react app how can I change the size and the font of the title of a antd card?

<Card title="Title" style={{ width: 300 }}>
  <p>Card content</p>
  <p>Card content</p>
  <p>Card content</p>
</Card>
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Antd has externized most of their styling variable in LESS variables

as you can see in

https://github.com/ant-design/ant-design/blob/master/components/style/themes/default.less

To be able to overwrite those variables you need to use modifyVar function from LESS

You can check more about theme updates here: https://ant.design/docs/react/customize-theme

So to your question you can check -
@card-head-font-size: @font-size-lg; @card-head-font-size-sm: @font-size-base

about 4 years ago · Juan Pablo Isaza Relatório

0

For example changing the font-size and font-family of the title using styled-components you can override the class like so:

import React from 'react';
import ReactDOM from 'react-dom';
import 'antd/dist/antd.css';
import './index.css';
import { Card } from 'antd';
import styled from 'styled-components';

const StyledCard = styled(Card)`
  .ant-card-head-title {
    font-size: 10px;
    font-family: cursive;
  }
`;

ReactDOM.render(
  <>
    <StyledCard title="Default size card" extra={<a href="#">More</a>} style={{ width: 300 }}>
      <p>Card content</p>
      <p>Card content</p>
      <p>Card content</p>
    </StyledCard>
  </>,
  document.getElementById('container'),
);

According to the docs,
You can also provide a ReactNode for the title prop, and style it as you want.

You also can check this sandBox:
https://codesandbox.io/s/basic-card-antd-4-18-5-forked-hfdnm?file=/index.js

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda