# Code

## Props

<table><thead><tr><th>Props</th><th width="359.66666666666663">Data Type</th><th>Required</th></tr></thead><tbody><tr><td>children</td><td><em>(WizardStep)</em></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>className</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>commland</td><td>boolean</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>title</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>type</td><td>string<br>(Initial, Edit)</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>confirmationValidation</td><td>boolean</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>confirmationStepTitle</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>confirmationContentTitle</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>confirmationContentDescription</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>confirmationButton</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>nextButton</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>previousButton</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>cancelButton</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>onCancel</td><td>Function Event</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>onConfirm</td><td>Function Event</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr></tbody></table>

{% hint style="info" %}
commland prop is used to adjust the Alert component to the Commland UI-Shell automatically.
{% endhint %}

### Where to Insert This Component?

This component should overlay all the content inside an application. Knowing that it can be inserted wherever the developer wants, it should not be affected by the rest of content structure.&#x20;

To keep a better order, we recommend inserting this component either at the beginning or at the end of a component component.

{% hint style="info" %}
At inserting it inside a Commland app, it should be placed outside/next to the AppPage component. If it is inserted inside the AppPageContent component, the modal is not going to render correctly.
{% endhint %}

### Type

By default, the type prop is set on 'Initial', forcing the Wizard to start on the first step to follow a specific order. In the case&#x20;

### onCancel and onConfirm

These actions are going to be executed only at clicking the cancel and confirmation buttons respectively. A difference between the Mini Wizard and the Modal component, is that by default the Mini Wizard is locked and it cannoty be exited in other ways but clicking the cancel button.

### Children

To generate the structure required for the component, the developer is able to insert the following components as children elements:

#### WizardStep

<table><thead><tr><th>Props</th><th width="359.66666666666663">Data Type</th><th>Required</th></tr></thead><tbody><tr><td>children</td><td><p>WizardStepActions <em>(Opcional)</em></p><p>WizardStepContent, WizardStepReview </p></td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>className</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>stepTitle</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr><tr><td>validation</td><td>boolean<br>(This should be connected to a state on the developers side)</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr></tbody></table>

#### WizardStepActions

<table><thead><tr><th>Props</th><th width="359.66666666666663">Data Type</th><th>Required</th></tr></thead><tbody><tr><td>children</td><td>Any</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>type</td><td>string<br>(Actions)</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>className</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr></tbody></table>

#### WizardStepContent

<table><thead><tr><th>Props</th><th width="359.66666666666663">Data Type</th><th>Required</th></tr></thead><tbody><tr><td>children</td><td>Any</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>type</td><td>string<br>(Content)</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>className</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr></tbody></table>

#### WizardStepReview

<table><thead><tr><th>Props</th><th width="359.66666666666663">Data Type</th><th>Required</th></tr></thead><tbody><tr><td>children</td><td>Any</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>type</td><td>string<br>(Review)</td><td><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span></td></tr><tr><td>className</td><td>string</td><td><span data-gb-custom-inline data-tag="emoji" data-code="274c">❌</span></td></tr></tbody></table>

### Example

```tsx
import React, { useState } from 'react';
import {
  Text,
  Button,
  Wizard,
  WizardStep,
  Checkbox
} from '@2600hz/sds-react-components';

const Example = ()=>{
  const [validations, setValidations] = useState({
    stepOne: true,
    stepTwo: true
  });

  const [confirmationValidation, setConfirmationValidation] = useState(true);

  const cancel = () => {
    console.log('cancel');
  };

  const confirm = () => {
    setConfirmationValidation(false);

    setTimeout(() => {
      console.log('Api test');
      setConfirmationValidation(true);
    }, 2000);
  };

  return (
    <Wizard
      title="Example"
      commland
      type="Edit"
      confirmationValidation={confirmationValidation}
      confirmationContentDescription="Lorem ipsum dolor sit amet, consectetur adipisicing elit. Itaque temporibus, hic ullam, ipsum corporis quas praesentium libero culpa eum accusamus, eos facere quasi ducimus voluptatibus aperiam necessitatibus reiciendis error totam."
      onCancel={cancel}
      onConfirm={confirm}
    >
      <WizardStep stepTitle="Step One" validation={validations.stepOne}>
        <WizardStepActions type="Actions" className="Actions">
          <Button icon="download">Download</Button>
          <Button icon="mail">Send Email</Button>
        </WizardStepActions>
        <WizardStepContent type="Content">
          <Text.p>
            Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi
            aliquam asperiores quis, fugiat dicta suscipit iusto voluptas
            ullam necessitatibus ducimus enim incidunt eos repellendus? Sunt
            nostrum vitae deleniti voluptatibus minima.
          </Text.p>
          <br />
          <Checkbox
            id="stepOne"
            checked={validations.stepOne}
            label="Validation"
            onChange={(e: any) => {
              setValidations((prevState) => ({
                ...prevState,
                stepOne: e.checked
              }));
            }}
          />
        </WizardStepContent>
        <WizardStepReview type="Review">
          <Text.p>Something...</Text.p>
          <Button>Example</Button>
        </WizardStepReview>
      </WizardStep>

      <WizardStep stepTitle="Step Two">
        <WizardStepContent type="Content">
          <Text.p>
            Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi
            aliquam asperiores quis, fugiat dicta suscipit iusto voluptas
            ullam necessitatibus ducimus enim incidunt eos repellendus? Sunt
            nostrum vitae deleniti voluptatibus minima.
          </Text.p>
        </WizardStepContent>
        <WizardStepReview type="Review">
          <Text.p>Something...</Text.p>
        </WizardStepReview>
      </WizardStep>

      <WizardStep stepTitle="Step Three" validation={validations.stepTwo}>
        <WizardStepContent type="Content">
          <Text.p>
            Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi
            aliquam asperiores quis, fugiat dicta suscipit iusto voluptas
            ullam necessitatibus ducimus enim incidunt eos repellendus? Sunt
            nostrum vitae deleniti voluptatibus minima.
          </Text.p>
          <br />
          <Checkbox
            id="stepTwo"
            checked={validations.stepTwo}
            label="Validation"
            onChange={(e: any) => {
              setValidations((prevState) => ({
                ...prevState,
                stepTwo: e.checked
              }));
            }}
          />
        </WizardStepContent>
        <WizardStepReview type="Review">
          <Text.p>Something...</Text.p>
        </WizardStepReview>
      </WizardStep>
      <WizardStep stepTitle="Step Four">
        <WizardStepContent type="Content">
          <Text.p>
            Lorem ipsum dolor, sit amet consectetur adipisicing elit. Animi
            aliquam asperiores quis, fugiat dicta suscipit iusto voluptas
            ullam necessitatibus ducimus enim incidunt eos repellendus? Sunt
            nostrum vitae deleniti voluptatibus minima.
          </Text.p>
        </WizardStepContent>
        <WizardStepReview type="Review">
          <Text.p>Something...</Text.p>
        </WizardStepReview>
      </WizardStep>
    </Wizard>
);
}

export default App;

```

## Components Dependency

For this component elaboration there were used the following internal components:

* [Tooltip](/sds/sds-components/simple-components/tooltip.md)
* [Telicon](/sds/sds-components/simple-components/telicon.md)
* [Button](/sds/sds-components/simple-components/button.md)
* [Text](/sds/sds-components/simple-components/text.md)

## Live Demo <a href="#live-demo" id="live-demo"></a>

For detailed code usage documentation, see the Storybooks for each framework below.​

### React <a href="#react" id="react"></a>

{% embed url="<https://sipster-react-component-storybook.netlify.app/?path=%2Fstory%2Fgeneral-components-wizard--wizard>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://2600hz.gitbook.io/sds/sds-components/simple-components/wizard/code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
