Files
react-test/docs/data/joy/components/stepper/ButtonStepper.js
how2ice 005cf56baf
Some checks failed
No response / noResponse (push) Has been cancelled
CI / Continuous releases (push) Has been cancelled
CI / test-dev (macos-latest) (push) Has been cancelled
CI / test-dev (ubuntu-latest) (push) Has been cancelled
CI / test-dev (windows-latest) (push) Has been cancelled
Maintenance / main (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
init project
2025-12-12 14:26:25 +09:00

36 lines
1.1 KiB
JavaScript

import * as React from 'react';
import Stepper from '@mui/joy/Stepper';
import Step from '@mui/joy/Step';
import StepButton from '@mui/joy/StepButton';
import StepIndicator from '@mui/joy/StepIndicator';
import Check from '@mui/icons-material/Check';
const steps = ['Order placed', 'In review', 'Approved'];
export default function ButtonStepper() {
const [activeStep, setActiveStep] = React.useState(1);
return (
<Stepper sx={{ width: '100%' }}>
{steps.map((step, index) => (
<Step
key={step}
indicator={
<StepIndicator
variant={activeStep <= index ? 'soft' : 'solid'}
color={activeStep < index ? 'neutral' : 'primary'}
>
{activeStep <= index ? index + 1 : <Check />}
</StepIndicator>
}
sx={[
activeStep > index &&
index !== 2 && { '&::after': { bgcolor: 'primary.solidBg' } },
]}
>
<StepButton onClick={() => setActiveStep(index)}>{step}</StepButton>
</Step>
))}
</Stepper>
);
}