Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!