-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize horizontal steps as a subpage of steps
- Loading branch information
Showing
3 changed files
with
96 additions
and
85 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/website/docs/components/navigation/steps/_category_.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
link: | ||
type: doc | ||
id: navigation_steps |
93 changes: 93 additions & 0 deletions
93
packages/website/docs/components/navigation/steps/horizontal_steps.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters