# dimevh

> A simple wizard for React 🧙‍♂️

Latest version **0.2.6** (published 2023-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install dimevh
pnpm add dimevh
yarn add dimevh
bun add dimevh
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2023-04-07 |
| First published | 2022-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 31.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Waryen |
| Maintainers | waryen |
| Keywords | javascript, typescript, react, wizard, stepper |

## Links

- npm: https://www.npmjs.com/package/dimevh
- Repository: https://github.com/Waryen/dimevh
- Issues: https://github.com/Waryen/dimevh/issues
- npm.io page: https://npm.io/package/dimevh

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^18.2.0
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.6 (latest) — 2023-04-07
- 0.2.5 — 2023-02-04
- 0.2.4 — 2022-12-29
- 0.2.3 — 2022-11-25
- 0.2.2 — 2022-11-25
- 0.2.1 — 2022-11-25
- 0.2.0 — 2022-11-25

## README

# Dimevh 🧙‍♂️

Yet another wizard package for React...

## Installation

```
$ npm install dimevh
```

## Features

- A provider component which you pass your steps components as children.
- A consumer hook to... consume the methods and values of the wizard.

## Code examples

Here is some code examples of how to use the wizard.

### Wizard provider

This is the component to wrap your steps component with.

```js
import { WizardProvider } from 'dimevh';

export default function Index() {
  return (
    <WizardProvider>
      <Step1 />
      <Step2 />
      <Step3 />
    </WizardProvider>
  );
}
```

or with optionnal props.

```js
import Header from './header';
import Footer from './footer';
import { WizardProvider } from 'dimevh';

export default function Index() {
  const closeWizard = () => {
    // ...
  };

  return (
    <WizardProvider
      header={(props) => <Header {...props} />}
      footer={(props) => <Footer {...props} />}
      initialIndex={2}
      onStartReached={closeWizard}
      onEndReached={closeWizard}
    >
      <Step1 />
      <Step2 />
      <Step3 />
    </WizardProvider>
  );
}
```

### useWizard

This is the consummer hook, use it inside your steps components to retrieve the wizard functions and values.

```js
import { useWizard } from 'dimevh';

export default function Step1() {
  const {
    activeIndex,
    previousIndex,
    maxAmountOfSteps,
    state,
    setState,
    goToPreviousStep,
    goToNextStep,
    goToFirstStep,
    goToLastStep,
    goToStep,
  } = useWizard();

  // ...
}
```

## Contributing

PRs are very welcome!  
Just open a PR and I will check it as soon as possible.

---
_Source: https://npm.io/package/dimevh · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
