Skip to content

Commit

Permalink
chore: update example with object declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
innocenzi committed Jul 6, 2022
1 parent 9d2e175 commit 5262bd6
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions packages/core/useStepper/index.md
Expand Up @@ -8,6 +8,8 @@ Provides helpers for building a multi-step wizard interface.

## Usage

### Steps as array

```js
import { useStepper } from '@vueuse/core'

Expand All @@ -34,4 +36,49 @@ const {
'terms',
'payment',
])

// Access the step through `current`
console.log(current.value) // 'billing-address'
```

### Steps as object

```js
import { useStepper } from '@vueuse/core'

const {
steps,
stepNames,
index,
current,
next,
previous,
isFirst,
isLast,
goTo,
goNext,
goPrevious,
goBackTo,
isNext,
isPrevious,
isCurrent,
isBefore,
isAfter,
} = useStepper({
'user-information': {
title: 'User information',
},
'billing-address': {
title: 'Billing address',
},
'terms': {
title: 'Terms',
},
'payment': {
title: 'Payment',
},
})

// Access the step object through `current`
console.log(current.value.title) // 'User information'
```

0 comments on commit 5262bd6

Please sign in to comment.