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

237
Vistas
How to change the border color of cards by checking the condition in react js

I have a variable that gets the value from the rest api in json format. The variable is data rate. The conditions are such that if the data rate is greater than 1MB it is said to be active and the border color should be green, if less than 1MB it is said to be inactive. Similarly there are few other conditions as well. How to change the border of the card automatically considering the value. So my question is how to add conditioning for the border color within the card tab.

  <Card className="cluster-cards" >
  <Card.Header as="h5">Cluster-1 [ID]</Card.Header>
  <Card.Body>
    <Card.Text>
      <Card border="dark" bg="light" style={{ width: '18rem' }} className ="sub-cards">
        <Card.Header>CAN 1</Card.Header>
          <Card.Body>
          <Card.Text>
            <h6><Badge pill bg="primary">Source ID-{783}</Badge></h6>  
            <h6><Badge pill bg="secondary">Data Rate-{'345Kbps'}</Badge></h6> 
            <h6><Badge pill bg="info">Total amount of data received-{'6MB'}</Badge></h6>   
          </Card.Text>
          </Card.Body>
      </Card>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can try this.

const customStyle = {
  borderColor: conditionState ? "#fff" : "red"
}
<Card className="cluster-cards" style={customStyle} >

//OR

<Card className="cluster-cards" className={${conditionState ? "border-none" : "border-red"}} >

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