Tour
The tour components provided by EUI allow for a flexible and customizable way to showcase items on a page in an ordered manner by augmenting existing elements on the page without altering functionality.
Examples on this page use localStorage to persist state.
Wrap target element
The EuiTourStep component is the base for building a feature tour or an individual popover for onboarding.
All content and actions including titles, headings, and buttons are customizable via props.
Anchor to DOM element
Instead of wrapping the target element, use the
anchor
prop to specify a DOM node. Accepted values include an HTML element reference, a function returning an HTML element, or a CSS selector string such as anchor="#anchorTarget"
.Guided tour
Uers proceed through tour steps without needing to complete actions on the underlying page. In this scenario, consider showing both Close tour and Next buttons.
Standalone steps
Each EuiTourStep can be configured independently via props. In this case, each component is stateless and needs to be paired with some form of state management for navigation. The later examples showcase other ways to handle state management via useEuiTour and EuiTour.
useEuiTour hook
The useEuiTour hook provides minimal state management using a predefined React reducer. Pass an array of steps consisting of accepted props, and an object of global configuration. The result is a full configuration object for each step, a set of reducer actions to perform state changes, and an up-to-date state object derived from the internal reducer.
EuiTour render prop component
The EuiTour render prop component provides minimal state management. An alternative to the useEuiTour hook, EuiTour can be used for React class components and use cases with a single wrapping component.
Tour demo
A complete tour set in a more realistic application UI. Unlike other examples on this page, the demo does not use localStorage
to persist state.
Props
EuiTourStep
Prop | Description and type | Default value |
---|---|---|
Prop content# | Description and type Contents of the tour step popover ReactNode | Default value Required |
Prop onFinish# | Description and type Function to call for 'Skip tour' and 'End tour' actions NoArgCallback<void> | Default value Required |
Prop stepsTotal# | Description and type The total number of steps in the tour number | Default value Required |
Prop title# | Description and type Larger title text specific to this step. The title gets wrapped in the appropriate heading level. ReactNode | Default value Required |
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Provide a name to the popover panel string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
Prop zIndex# | Description and type By default, popover content inherits the z-index of the anchor number | Default value |
Prop children# | Description and type Element to which the tour step popover attaches when open ReactNode & ReactElement<any, string | JSXElementConstructor<any>> | Default value |
Prop aria-labelledby# | Description and type Alternative option to string | Default value |
Prop container# | Description and type Restrict the popover's position within this element HTMLElement | Default value |
Prop display# | Description and type CSS display type for both the popover and anchor Display | Default value |
Prop offset# | Description and type Distance away from the anchor that the popover will render number | Default value |
Prop panelRef# | Description and type Type: RefCallback<HTMLElement> | Default value |
Prop ownFocus# | Description and type Traps tab focus within the popover contents boolean | Default value |
Prop focusTrapProps# |