{Math.abs(activeStep - index) <= 2 ? (
({
root: {
maxWidth: 400,
@@ -44,23 +16,43 @@ const useStyles = makeStyles((theme) => ({
display: 'flex',
alignItems: 'center',
height: 50,
- paddingLeft: theme.spacing(4),
+ paddingLeft: theme.spacing(2),
backgroundColor: theme.palette.background.default,
},
- img: {
+ stepContent: {
height: 255,
maxWidth: 400,
- overflow: 'hidden',
- display: 'block',
width: '100%',
+ padding: theme.spacing(2),
},
}));
+const steps = [
+ {
+ label: 'Select campaign settings',
+ description: `For each ad campaign that you create, you can control how much
+ you're willing to spend on clicks and conversions, which networks
+ and geographical locations you want your ads to show on, and more.`,
+ },
+ {
+ tabel: 'Create an ad group',
+ description:
+ 'An ad group contains one or more ads which target a shared set of keywords.',
+ },
+ {
+ label: 'Create an ad',
+ description: `Try out different ad text to see what brings in the most customers,
+ and learn how to enhance your ads using features like ad extensions.
+ If you run into any problems with your ads, find out how to tell if
+ they're running and how to resolve approval issues.`,
+ },
+];
+
export default function TextMobileStepper() {
const classes = useStyles();
const theme = useTheme();
const [activeStep, setActiveStep] = React.useState(0);
- const maxSteps = tutorialSteps.length;
+ const maxSteps = steps.length;
const handleNext = () => {
setActiveStep((prevActiveStep) => prevActiveStep + 1);
@@ -73,17 +65,12 @@ export default function TextMobileStepper() {
return (
createStyles({
root: {
@@ -50,24 +22,44 @@ const useStyles = makeStyles((theme: Theme) =>
display: 'flex',
alignItems: 'center',
height: 50,
- paddingLeft: theme.spacing(4),
+ paddingLeft: theme.spacing(2),
backgroundColor: theme.palette.background.default,
},
- img: {
+ stepContent: {
height: 255,
maxWidth: 400,
- overflow: 'hidden',
- display: 'block',
width: '100%',
+ padding: theme.spacing(2),
},
}),
);
+const steps = [
+ {
+ label: 'Select campaign settings',
+ description: `For each ad campaign that you create, you can control how much
+ you're willing to spend on clicks and conversions, which networks
+ and geographical locations you want your ads to show on, and more.`,
+ },
+ {
+ tabel: 'Create an ad group',
+ description:
+ 'An ad group contains one or more ads which target a shared set of keywords.',
+ },
+ {
+ label: 'Create an ad',
+ description: `Try out different ad text to see what brings in the most customers,
+ and learn how to enhance your ads using features like ad extensions.
+ If you run into any problems with your ads, find out how to tell if
+ they're running and how to resolve approval issues.`,
+ },
+];
+
export default function TextMobileStepper() {
const classes = useStyles();
const theme = useTheme();
const [activeStep, setActiveStep] = React.useState(0);
- const maxSteps = tutorialSteps.length;
+ const maxSteps = steps.length;
const handleNext = () => {
setActiveStep((prevActiveStep) => prevActiveStep + 1);
@@ -80,17 +72,12 @@ export default function TextMobileStepper() {
return (
({
root: {
- width: '100%',
+ maxWidth: 400,
},
button: {
marginTop: theme.spacing(1),
@@ -24,32 +24,30 @@ const useStyles = makeStyles((theme) => ({
},
}));
-function getSteps() {
- return ['Select campaign settings', 'Create an ad group', 'Create an ad'];
-}
-
-function getStepContent(step) {
- switch (step) {
- case 0:
- return `For each ad campaign that you create, you can control how much
+const steps = [
+ {
+ label: 'Select campaign settings',
+ description: `For each ad campaign that you create, you can control how much
you're willing to spend on clicks and conversions, which networks
- and geographical locations you want your ads to show on, and more.`;
- case 1:
- return 'An ad group contains one or more ads which target a shared set of keywords.';
- case 2:
- return `Try out different ad text to see what brings in the most customers,
+ and geographical locations you want your ads to show on, and more.`,
+ },
+ {
+ label: 'Create an ad group',
+ description:
+ 'An ad group contains one or more ads which target a shared set of keywords.',
+ },
+ {
+ label: 'Create an ad',
+ description: `Try out different ad text to see what brings in the most customers,
and learn how to enhance your ads using features like ad extensions.
If you run into any problems with your ads, find out how to tell if
- they're running and how to resolve approval issues.`;
- default:
- return 'Unknown step';
- }
-}
+ they're running and how to resolve approval issues.`,
+ },
+];
export default function VerticalLinearStepper() {
const classes = useStyles();
const [activeStep, setActiveStep] = React.useState(0);
- const steps = getSteps();
const handleNext = () => {
setActiveStep((prevActiveStep) => prevActiveStep + 1);
@@ -66,8 +64,8 @@ export default function VerticalLinearStepper() {
return (
diff --git a/docs/src/pages/components/steppers/VerticalLinearStepper.tsx b/docs/src/pages/components/steppers/VerticalLinearStepper.tsx
index 897bf7c7b26845..7f3a391a778e7b 100644
--- a/docs/src/pages/components/steppers/VerticalLinearStepper.tsx
+++ b/docs/src/pages/components/steppers/VerticalLinearStepper.tsx
@@ -11,7 +11,7 @@ import Typography from '@material-ui/core/Typography';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
- width: '100%',
+ maxWidth: 400,
},
button: {
marginTop: theme.spacing(1),
@@ -26,32 +26,30 @@ const useStyles = makeStyles((theme: Theme) =>
}),
);
-function getSteps() {
- return ['Select campaign settings', 'Create an ad group', 'Create an ad'];
-}
-
-function getStepContent(step: number) {
- switch (step) {
- case 0:
- return `For each ad campaign that you create, you can control how much
+const steps = [
+ {
+ label: 'Select campaign settings',
+ description: `For each ad campaign that you create, you can control how much
you're willing to spend on clicks and conversions, which networks
- and geographical locations you want your ads to show on, and more.`;
- case 1:
- return 'An ad group contains one or more ads which target a shared set of keywords.';
- case 2:
- return `Try out different ad text to see what brings in the most customers,
+ and geographical locations you want your ads to show on, and more.`,
+ },
+ {
+ label: 'Create an ad group',
+ description:
+ 'An ad group contains one or more ads which target a shared set of keywords.',
+ },
+ {
+ label: 'Create an ad',
+ description: `Try out different ad text to see what brings in the most customers,
and learn how to enhance your ads using features like ad extensions.
If you run into any problems with your ads, find out how to tell if
- they're running and how to resolve approval issues.`;
- default:
- return 'Unknown step';
- }
-}
+ they're running and how to resolve approval issues.`,
+ },
+];
export default function VerticalLinearStepper() {
const classes = useStyles();
const [activeStep, setActiveStep] = React.useState(0);
- const steps = getSteps();
const handleNext = () => {
setActiveStep((prevActiveStep) => prevActiveStep + 1);
@@ -68,8 +66,8 @@ export default function VerticalLinearStepper() {
return (
diff --git a/docs/src/pages/components/steppers/steppers.md b/docs/src/pages/components/steppers/steppers.md
index a76df96774c9a1..54fea3edf91b5d 100644
--- a/docs/src/pages/components/steppers/steppers.md
+++ b/docs/src/pages/components/steppers/steppers.md
@@ -19,32 +19,25 @@ Steppers may display a transient feedback message after a step is saved.
> **Note:** Steppers are no longer documented in the [Material Design guidelines](https://material.io/), but Material-UI will continue to support them.
-## Horizontal Stepper
+## Horizontal stepper
+
+Horizontal steppers are ideal when the contents of one step depend on an earlier step.
+
+Avoid using long step names in horizontal steppers.
### Linear
+A linear stepper allows the user to complete the steps in sequence.
+
The `Stepper` can be controlled by passing the current step index (zero-based) as the `activeStep` prop. `Stepper` orientation is set using the `orientation` prop.
This example also shows the use of an optional step by placing the `optional` prop on the second `Step` component. Note that it's up to you to manage when an optional step is skipped. Once you've determined this for a particular step you must set `completed={false}` to signify that even though the active step index has gone beyond the optional step, it's not actually complete.
{{"demo": "pages/components/steppers/HorizontalLinearStepper.js"}}
-### Linear - Alternative Label
-
-Labels can be placed below the step icon by setting the `alternativeLabel` prop on the `Stepper` component.
-
-{{"demo": "pages/components/steppers/HorizontalLinearAlternativeLabelStepper.js"}}
-
-### Customized Stepper
-
-Here is an example of customizing the component. You can learn more about this in the
-[overrides documentation page](/customization/components/).
-
-{{"demo": "pages/components/steppers/CustomizedSteppers.js"}}
-
### Non-linear
-Non-linear steppers allow users to enter a multi-step flow at any point.
+Non-linear steppers allow the user to enter a multi-step flow at any point.
This example is similar to the regular horizontal stepper, except steps are no longer automatically set to `disabled={true}` based on the `activeStep` prop.
@@ -54,41 +47,51 @@ determine when all steps are completed (or even if they need to be completed).
{{"demo": "pages/components/steppers/HorizontalNonLinearStepper.js"}}
-### Non-linear - Alternative Label
+### Alternative Label
Labels can be placed below the step icon by setting the `alternativeLabel` prop on the `Stepper` component.
-{{"demo": "pages/components/steppers/HorizontalNonLinearAlternativeLabelStepper.js"}}
+{{"demo": "pages/components/steppers/HorizontalLinearAlternativeLabelStepper.js"}}
+
+### Error step
-### Non-linear - Error Step
+{{"demo": "pages/components/steppers/HorizontalStepperWithError.js"}}
-{{"demo": "pages/components/steppers/HorizontalNonLinearStepperWithError.js"}}
+### Customized horizontal stepper
-## Vertical Stepper
+Here is an example of customizing the component. You can learn more about this in the
+[overrides documentation page](/customization/components/).
+
+{{"demo": "pages/components/steppers/CustomizedSteppers.js"}}
+
+## Vertical stepper
+
+Vertical steppers are designed for narrow screen sizes. They are ideal for mobile. All the features of the horizontal stepper can be implemented.
{{"demo": "pages/components/steppers/VerticalLinearStepper.js"}}
-## Mobile Stepper
+## Mobile stepper
+
+This component implements a compact stepper suitable for a mobile device. IT has more limited functionality than the vertical stepper. See [mobile steps](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steps) for its inspiration.
-This component implements a compact stepper suitable for a mobile device. See [mobile steps](https://material.io/archive/guidelines/components/steppers.html#steppers-types-of-steps) for its inspiration.
+The mobile stepper supports three variants to display progress through the available steps: text, dots, and progress.
### Text
-This is essentially a back/next button positioned correctly.
-You must implement the textual description yourself, however, an example is provided below for reference.
+The current step and total number of steps are displayed as text.
{{"demo": "pages/components/steppers/TextMobileStepper.js", "bg": true}}
-### Text with Carousel effect
+### Text with carousel effect
-This demo is very similar to the previous, the difference is the usage of
-[react-swipeable-views](https://github.com/oliviertassinari/react-swipeable-views) to make the transition of steps.
+This demo uses
+[react-swipeable-views](https://github.com/oliviertassinari/react-swipeable-views) to create a carousel.
{{"demo": "pages/components/steppers/SwipeableTextMobileStepper.js", "bg": true}}
### Dots
-Use dots when the number of steps isn’t large.
+Use dots when the number of steps is small.
{{"demo": "pages/components/steppers/DotsMobileStepper.js", "bg": true}}