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

218
Visualizações
How can I animate a hidden card to appear

I have a set of MUI cards. One of these cards is hidden until the other cards are expanded. When the cards expand, the hidden card then appears. I want to animate the hidden card so that it does not suddenly pop in.

**  Styling **
const useStyles = makeStyles((theme) => ({
    summaryBox: {
        display: "flex",
    },
    qCard: {
        backgroundColor: "#D9F5FD",
        border: "1px solid #E1E1E1",
        width: "5vw",
        height: "auto",
        marginRight: "1vw",
        animation: "pop 500ms ease-in-out forwards",
    },
    expand: {
        transform: "rotate(0deg)",
        marginLeft: "auto",
        transition: theme.transitions.create("transform", {
            duration: theme.transitions.duration.shortest,
        }),
    },
    expandOpen: {
        transform: "rotate(180deg)",
    },
}));
...

const [expanded, setExpanded] = useState(false);
const [hidden, setHidden] = useState(true);
const handleExpandClick = () => {
    setExpanded(!expanded);
    setHidden(!hidden);
};

...
<Box className={classes.summaryBox} onClick={handleExpandClick} aria-expanded={expanded}>
    <Card className={classes.qCard} hidden={hidden}>
        <Collapse in={expanded} timeout="auto" unmountOnExit>
        </Collapse>
    </Card>
</Box>
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try adding this css,


qCard: {
    backgroundColor: "#D9F5FD",
    border: "1px solid #E1E1E1",
    width: 0,
    height: 0,
    marginRight: "1vw",
    animation: "pop 500ms ease-in-out forwards"
},

@keyframes {
  from {
    width: 0;
    height: 0;
  }
  to {
    width: "5vw";
    height: "auto";
  }
}

Use this animation with styling framework you are using.

about 4 years ago · Juan Pablo Isaza Relatório

0

I can suggest of use the easing prop on the collapse component. https://mui.com/material-ui/api/collapse/

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