Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="relative flex min-h-screen flex-col justify-center overflow-hidden bg-gray-50 py-6 sm:py-12">
  <div class="mx-auto w-full max-w-lg">
    <form action="https://api.web3forms.com/submit" method="post" id="npsform">
      <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY_HERE">
      <div class="step" id="step1">
        <h2 class="mx-auto max-w-xs text-center text-xl font-bold">How likely are you to recommend Web3Forms to a friend?</h2>
        <div class="mt-4 flex gap-1 justify-between">
          <div>
            <input type="radio" id="zero" name="nps" value="0" class="navigate peer hidden" data-step="2" />
            <label for="zero" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">0</label>
          </div>
          <div>
            <input type="radio" id="one" name="nps" value="1" class="navigate peer hidden" data-step="2" />
            <label for="one" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">1</label>
          </div>

          <div>
            <input type="radio" id="two" name="nps" value="2" class="navigate peer hidden" data-step="2" />
            <label for="two" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">2</label>
          </div>

          <div>
            <input type="radio" id="three" name="nps" value="3" class="navigate peer hidden" data-step="2" />
            <label for="three" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">3</label>
          </div>
          <div>
            <input type="radio" id="four" name="nps" value="4" class="navigate peer hidden" data-step="2" />
            <label for="four" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">4</label>
          </div>
          <div>
            <input type="radio" id="five" name="nps" value="5" class="navigate peer hidden" data-step="2" />
            <label for="five" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">5</label>
          </div>
          <div>
            <input type="radio" id="six" name="nps" value="6" class="navigate peer hidden" data-step="2" />
            <label for="six" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">6</label>
          </div>
          <div>
            <input type="radio" id="seven" name="nps" value="7" class="navigate peer hidden" data-step="2" />
            <label for="seven" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">7</label>
          </div>
          <div>
            <input type="radio" id="eight" name="nps" value="8" class="navigate peer hidden" data-step="2" />
            <label for="eight" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">8</label>
          </div>
          <div>
            <input type="radio" id="nine" name="nps" value="9" class="navigate peer hidden" data-step="2" />
            <label for="nine" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">9</label>
          </div>
          <div>
            <input type="radio" id="ten" name="nps" value="10" class="navigate peer hidden" data-step="2" />
            <label for="ten" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-md border bg-white text-lg font-medium shadow hover:border-gray-400 peer-checked:border-indigo-500 peer-checked:text-indigo-500">10</label>
          </div>
        </div>
        <div class="flex justify-between mt-2 text-gray-500 text-sm">
          <span>Less Likely</span>
          <span>Very Likely</span>
        </div>
      </div>

      <div class="step hidden" id="step2">
        <h2 class="mx-auto text-center text-xl font-bold"> Can you tell us a bit more about your score?</h2>

        <div class="mt-4">
          <textarea name="comments" rows="3" class="w-full rounded-md border bg-white   shadow border-gray-400 focus:border-indigo-500 "></textarea>
        </div>
        <div class="relative"> <a href="#!" class="absolute top-0 left-0 navigate underline text-gray-500 text-sm" data-step="1"> Go back</a> </div>

        <div class="flex justify-center mt-2"><button type="submit" class="px-10 py-2 rounded-md border bg-white text-lg font-medium shadow border-gray-400">Submit</button></div>

        <div id="result"></div>

      </div>
    </form>
  </div>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                const form = document.getElementById("npsform");

/**
 * Multi-step Function to navigate
 */

const navigateToFormStep = (stepNumber) => {
  form.querySelectorAll(".step").forEach((el) => {
    el.classList.add("hidden");
  });

  form.querySelector("#step" + stepNumber).classList.remove("hidden");
};

/**
 * Enable Navigation buttons
 */

form.querySelectorAll(".navigate").forEach((nav) => {
  nav.addEventListener("click", () => {
    const stepNumber = parseInt(nav.getAttribute("data-step"));
    navigateToFormStep(stepNumber);
  });
});

              
            
!
999px

Console