Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
Targeting the label in React Admin's DeleteButton

I'm doing a React Admin based project, and I have my own DeleteButton component which uses React Admin's DeleteButton export (https://marmelab.com/react-admin/Buttons.html#deletebutton) with some styles applied.

For my DeleteButton, I've opted to get rid of the icon on it by passing in icon={<></>} as a prop. This works, but the text/label on the button has a 0.5em left padding on it and is causing it to look a bit odd.

It currently looks like this.

I was hoping to supply a style that targets the label and removes the left padding, but so far I've been unable to figure it out, and I was wondering if anyone could help me with it.

I've tried supplying a few things as a classes prop:

const useDeleteButtonStyles = makeStyles({label: {leftPadding: 0}});
const useDeleteButtonStyles = makeStyles({MuiButton: {label: {leftPadding: 0}}});
const useDeleteButtonStyles = makeStyles({RaButton: {label: {leftPadding: 0}}});

const deleteButtonClasses = deleteButtonStyles();

<DeleteButton icon={<></>} classes={deleteButtonClasses} />

But so far, none of them have had any effect. I did see there was also a labelRightIcon property but I've not changed the position of the icon on my DeleteButton so I believe it should be the regular label prop.

I did find that passing those classes does work on a regular React Admin Button, it just doesn't seem to on the specific action ones.

The only way I've managed to hit it is with a global addition to the theme that targets RaButton.label, but that removes the padding from ALL buttons including ones that I want to keep the padding on as they have icons.

I'm not sure if I've incorrectly assumed I can also use classes on the action ones like DeleteButton or if I'm just plain doing it incorrectly, but if anyone can provide some insight I'd really appreciate it.

Thanks!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda