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

280
Views
Mui V5 Snackbar posición personalizada

Estoy tratando de colocar un Snackbar en la parte superior derecha con algo de personalización superior, pero no puedo configurarlo correctamente.

Aquí está mi intento:

 import React from "react"; import { Snackbar, Alert } from "@mui/material"; import { styled } from "@mui/material/styles"; const StyledSnackbar = styled(Snackbar)(({ theme, props }) => ({ "& MuiSnackbar-root": { top: theme.spacing(15), }, })); export default function Notification(props) { const { notify, setNotify } = props; return ( <StyledSnackbar open={notify.isOpen} autoHideDuration={3000} anchorOrigin={{ vertical: "top", horizontal: "right" }} > <Alert severity={notify.type}>{notify.message}</Alert> </StyledSnackbar> ); }

Entonces lo intenté

 const StyledSnackbar = styled(Snackbar)(() => ({ "& MuiSnackbar-root": { top: "100px", }, }));

Pero sigue sin funcionar, el Snackbar está fijo arriba/a la derecha

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Finalmente lo descubrí, pero no estoy seguro de si esta es la mejor manera de implementarlo. ¿Por favor, hágame saber sus pensamientos? y si hay una mejor manera de hacerlo.

 import React from "react"; import { Snackbar, Alert } from "@mui/material"; import { styled } from "@mui/material/styles"; const StyledSnackbar = styled((props) => <Snackbar {...props} />)( ({ theme }) => ({ "& .MuiSnackbar-root": { top: theme.spacing(15), }, }) ); export default function Notification(props) { const { notify, setNotify } = props; return ( <StyledSnackbar open={notify.isOpen} autoHideDuration={3000} anchorOrigin={{ vertical: "top", horizontal: "right" }} > <Alert severity={notify.type}>{notify.message}</Alert> </StyledSnackbar> ); }
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!