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

165
Visualizações
Is it not possible to style a nested component within MUI's 'styled()' function?

As you can see below, I am trying to style an MUI Stack component within an MUI Dialog component, but the Stack styles are not being applied in my code:

const CustomDialog = styled(Dialog)(({ theme }) => ({

    '& .MuiDialog-paper': {
        backgroundColor: theme.palette.error.light,
        color: theme.palette.background.default,
        textAlign: 'center',
    },
    '& .MuiDialogContent-root': {
        marginTop: 2,
        marginBottom: 2,
    },
    '& .MuiStack-root': {
        direction: 'row',
        spacing: 1,
        padding: 1,
    },
    '& .MuiButton-root': {

        ':first-of-type': {
            color: theme.palette.error.light,
            backgroundColor: theme.palette.background.default,
            ':hover': {
                backgroundColor: theme.palette.error.dark
            }
        },
        ':last-of-type': {
            backgroundColor: theme.palette.success.main,
            ':hover': {
                backgroundColor: theme.palette.success.dark
            }
        }


    }

}));

And here is the CustomDialog in action:

    <CustomDialog>
        <DialogTitle>
            ...
        </DialogTitle>

        <DialogContent>
            ...
        </DialogContent>

        <Stack>
            <Button>
                ...
            </Button>

            <Button>
                ...
            </Button>
        </Stack>

    </CustomDialog>;

The Stack should be aligning the buttons next to each other, but they are still on top of each other vertically

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

At the Stack you can add direction prop to setting that the way you want, I provide the code example you can try.

<Stack direction="row">
            <Button>
               ...
            </Button>

            <Button>
                ...
            </Button>
        </Stack>

about 4 years ago · Santiago Gelvez 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