Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(progress-stepper): add horizontal width limitation example #2925

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
);
}
Loading