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

100
Vistas
MUI - Click link in Checkbox label

I want to make a "Terms of Use" checkbox, and I'm using FormControlLabel for nesting a Checkbox for it, but I need to make a link that when clicked is opening a Dialog component, that is rendering the terms, but when I click on the link "" it also checks the checkbox, since it's inside the label.

It's pretty hard trying to make a structure to make it look good, so it would be beneficial if it was possible to render the link inside the label as well.

Here is the code:

<FormGroup row className={localClasses.greenCheckbox}>
  <FormControlLabel
    control={
      <Checkbox
        checked={state.lgpd_agreement}
        onChange={lgpdAgreementOnChange}
        name="lgpd_agreement"
      />
    }
    label={
      <p>
        Autorizo a #### coletar e armazenar meus dados com a finalidade
        de fornecer os serviços do programa conforme o respectivo
        Termo&nbsp;
  <span className={localClasses.openDialogButton} onClick={() => handleOpenModal('authTerm')}>Ler</span>
      </p>
    }
  />
</FormGroup>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Call e.preventDefault() to cancel the current event so the Checkbox state is not updated:

<FormControlLabel
  control={<Checkbox name="lgpd_agreement" />}
  label={
    <p>
      random text
      <Link
        onClick={(e) => {
          e.preventDefault();
          alert('link clicked!');
        }}
      >
        Your Link
      </Link>
    </p>
  }
/>

Codesandbox Demo

about 4 years ago · Juan Pablo Isaza Denunciar
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