Sign up and get 15% off every plan.

Sign up
Menu
FeedbackMaterial UIMIT licenceFree

Alert

A short message in a coloured box: success, info, warning or error.

Add it to your project

Or install the packages yourselfTerminal
npm install @mui/material

The code

components/alert-demo.tsxReact
/**
 * Demo from Material UI, https://mui.com/material-ui/ (docs demo BasicAlerts)
 * MIT License, Copyright (c) 2014 Call-Em-All. Full text: https://github.com/mui/material-ui/blob/master/LICENSE
 */
'use client';
import Alert from '@mui/material/Alert';
import Stack from '@mui/material/Stack';

export default function BasicAlerts() {
  return (
    <Stack sx={{ width: '100%' }} spacing={2}>
      <Alert severity="success">This is a success Alert.</Alert>
      <Alert severity="info">This is an info Alert.</Alert>
      <Alert severity="warning">This is a warning Alert.</Alert>
      <Alert severity="error">This is an error Alert.</Alert>
    </Stack>
  );
}