/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/data/material/components/steppers/HorizontalStepperWithError.tsx
41 строка
1 KB
Siriwat K
[docs] Migrate content to the new location (#30757)
04 фев 2022, 07:13
Не верифицирован
04 фев 2022, 07:13
27f1c28
Код
Авторство
О чём код?
import * as React from 'react'; import Box from '@mui/material/Box'; import Stepper from '@mui/material/Stepper'; import Step from '@mui/material/Step'; import StepLabel from '@mui/material/StepLabel'; import Typography from '@mui/material/Typography'; const steps = ['Select campaign settings', 'Create an ad group', 'Create an ad']; export default function HorizontalStepperWithError() { const isStepFailed = (step: number) => { return step === 1; }; return ( <Box sx={{ width: '100%' }}> <Stepper activeStep={1}> {steps.map((label, index) => { const labelProps: { optional?: React.ReactNode; error?: boolean; } = {}; if (isStepFailed(index)) { labelProps.optional = ( <Typography variant="caption" color="error"> Alert message </Typography> ); labelProps.error = true; } return ( <Step key={label}> <StepLabel {...labelProps}>{label}</StepLabel> </Step> ); })} </Stepper> </Box> ); }