Skip to content

Commit

Permalink
docs(progress-stepper): add horizontal width limitation example
Browse files Browse the repository at this point in the history
  • Loading branch information
whitelisab committed Oct 29, 2024
1 parent 453e7f9 commit a383562
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/components/progress-stepper/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ Example of the ProgressStepper with buttons to move between steps.

```

### Horizontal Label Width Limitation

When the ProgressStepper renders in the horizontal orientation with labels, the component will have extra width on the sides of the first and last steps.
This extra width is necessary in order to accommodate the centering of the labels under each step.
This example demonstrates this extra width so that consumers of this component can plan accordingly in designs, as the ProgressStepper component will not be the same width as the content area.

```jsx file=./examples/ProgressStepperHorizontalWidthLimitation.tsx

```

## Props (API reference)

### ProgressStepper
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import React from 'react';
import { ProgressStepper } from '@contentful/f36-progress-stepper';
import { Box, Header } from '@contentful/f36-components';
import tokens from '@contentful/f36-tokens';
import { css } from 'emotion';

export default function ProgressStepperHorizontalWidthLimitation() {
const styles = {
root: css({
border: `1px solid ${tokens.gray300}`,
}),
stepperContainer: css({
padding: `${tokens.spacingS} 0`,
}),
headerContainer: css({
borderTop: `1px solid ${tokens.gray300}`,
}),
};

return (
<Box className={styles.root}>
<Box className={styles.stepperContainer}>
<ProgressStepper
activeStep={2}
ariaLabel="Horizontal progress stepper width limitation example"
>
<ProgressStepper.Step state="complete" labelText="Label 1" />
<ProgressStepper.Step state="complete" labelText="Label 2" />
<ProgressStepper.Step state="active" labelText="Label 3" />
<ProgressStepper.Step labelText="Label 4" />
<ProgressStepper.Step labelText="Label 5" />
</ProgressStepper>
</Box>
<Box className={styles.headerContainer}>
<Header title="Header within the same parent container" />
</Box>
</Box>
);
}

0 comments on commit a383562

Please sign in to comment.