Skip to content

Commit

Permalink
Reorganize horizontal steps as a subpage of steps
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Nov 23, 2024
1 parent bd9e6cb commit fa74f0a
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
link:
type: doc
id: navigation_steps
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
slug: /navigation/steps/horizontal
id: navigation_steps_horizontal
---

# Horizontal steps

**EuiStepsHorizontal** should be used when forms/setup instructions can and should be split into multiple pages. Each step should correspond to an individual page of form elements, using the `status` key to denote the user's progress.

For horizontal steps, the `status` key defaults to `"incomplete"` and the default filled styling is reserved for indicating `"current"` status.

Use the `size` property to generate smaller step circles.

```tsx interactive
import React, { useState } from 'react';
import {
EuiStepsHorizontal,
EuiStepsHorizontalProps,
EuiStepsHorizontalSizes,
EuiButtonGroup,
EuiTitle,
EuiSpacer,
} from '@elastic/eui';

export default () => {
const horizontalSteps: EuiStepsHorizontalProps['steps'] = [
{
title: 'Completed step 1',
status: 'complete',
onClick: () => {},
},
{
title: 'Selected step 2',
status: 'current',
onClick: () => {},
},
{
title: 'Incomplete step 3 which will wrap to the next line',
onClick: () => {},
},
{
title: 'Disabled step 4',
status: 'disabled',
onClick: () => {},
},
];

const sizeButtons = [
{
id: 'xs',
label: 'XSmall',
},
{
id: 's',
label: 'Small',
},
{
id: 'm',
label: 'Medium',
},
];

const [toggleSize, setToggleSize] = useState<EuiStepsHorizontalSizes>('m');

const sizeOnChange = (optionId: EuiStepsHorizontalSizes) => {
setToggleSize(optionId);
};

return (
<>
<EuiTitle size="xxs">
<h3>Step Size</h3>
</EuiTitle>
<EuiSpacer size="s" />
<EuiButtonGroup
legend="Horizontal step size toggle"
options={sizeButtons}
idSelected={toggleSize}
onChange={(id) => sizeOnChange(id as EuiStepsHorizontalSizes)}
/>
<EuiStepsHorizontal steps={horizontalSteps} size={toggleSize} />
</>
);
};
```

## Props

import docgen from '@elastic/eui-docgen/dist/components/steps';

<PropTable definition={docgen.EuiStepsHorizontal} />

<PropTable definition={docgen.EuiStepHorizontal} />
Original file line number Diff line number Diff line change
Expand Up @@ -400,87 +400,6 @@ export default () => {
};
```

## Horizontal steps

For use when forms/setup instructions can and should be split into multiple pages. Each step should correspond to an individual page of form elements, using the `status` key to denote the user's progress.

For horizontal steps, the `status` key defaults to `"incomplete"` and the default filled styling is reserved for indicating `"current"` status.

Use the `size` property to generate smaller step circles.

```tsx interactive
import React, { useState } from 'react';
import {
EuiStepsHorizontal,
EuiStepsHorizontalProps,
EuiStepsHorizontalSizes,
EuiButtonGroup,
EuiTitle,
EuiSpacer,
} from '@elastic/eui';

export default () => {
const horizontalSteps: EuiStepsHorizontalProps['steps'] = [
{
title: 'Completed step 1',
status: 'complete',
onClick: () => {},
},
{
title: 'Selected step 2',
status: 'current',
onClick: () => {},
},
{
title: 'Incomplete step 3 which will wrap to the next line',
onClick: () => {},
},
{
title: 'Disabled step 4',
status: 'disabled',
onClick: () => {},
},
];

const sizeButtons = [
{
id: 'xs',
label: 'XSmall',
},
{
id: 's',
label: 'Small',
},
{
id: 'm',
label: 'Medium',
},
];

const [toggleSize, setToggleSize] = useState<EuiStepsHorizontalSizes>('m');

const sizeOnChange = (optionId: EuiStepsHorizontalSizes) => {
setToggleSize(optionId);
};

return (
<>
<EuiTitle size="xxs">
<h3>Step Size</h3>
</EuiTitle>
<EuiSpacer size="s" />
<EuiButtonGroup
legend="Horizontal step size toggle"
options={sizeButtons}
idSelected={toggleSize}
onChange={(id) => sizeOnChange(id as EuiStepsHorizontalSizes)}
/>
<EuiStepsHorizontal steps={horizontalSteps} size={toggleSize} />
</>
);
};
```

## Props

import docgen from '@elastic/eui-docgen/dist/components/steps';
Expand All @@ -489,10 +408,6 @@ import docgen from '@elastic/eui-docgen/dist/components/steps';

<PropTable definition={docgen.EuiStep} />

<PropTable definition={docgen.EuiStepsHorizontal} />

<PropTable definition={docgen.EuiStepHorizontal} />

<PropTable definition={docgen.EuiStepNumber} />

<PropTable definition={docgen.EuiSubSteps} />

0 comments on commit fa74f0a

Please sign in to comment.