Vue Stepper - Configure a Read-Only Stepper
You can disable all user interaction with Stepper by setting focusStateEnabled to false and assigning the pointer-events: none; CSS style to the component. Define and modify the selectedIndex property to control the Stepper state independently of the component. The code snippet below allows users to change the active step with two Buttons.
App.vue
- <template>
- <DxStepper
- id="stepper"
- :dataSource="dataSource"
- :selected-index="selectedIndex"
- :focus-state-enabled="false"
- />
- <DxButton
- text="Previous Step"
- @click="handlePreviousButtonClick()"
- />
- <DxButton
- text="Next Step"
- @click="handleNextButtonClick()"
- />
- </template>
- <script>
- // ...
- const selectedIndex = ref(0);
- const handlePreviousButtonClick = () => {
- if (selectedIndex.value > 0) {
- selectedIndex.value -= 1;
- }
- }
- const handleNextButtonClick = () => {
- if (selectedIndex.value < dataSource.length - 1) {
- selectedIndex.value += 1;
- }
- }
- </script>
- <style scoped>
- #stepper {
- pointer-events: none;
- }
- </style>