Contact form

Start a conversation. Labeled fields and native form validation.

Installation

Run the source CLI from a Blocks UI checkout. This package is not published to npm.

node packages/cli/index.js add contact-form

Or copy the source files above. Include tokens.css and base.css once in your project.

Usage

Use the authored row-and-column structure, then let the standalone runtime discover and enhance the block.

<div class="contact-form" data-demo>
  <form action="#contact" method="get">
    <div class="field"><label for="contact-name">Name (required)</label><input id="contact-name" name="name" autocomplete="name" required placeholder="Your name"></div>
    <div class="field"><label for="contact-email">Email (required)</label><input id="contact-email" name="email" type="email" autocomplete="email" required placeholder="you@example.com"></div>
    <div class="field"><label for="contact-message">Message (required)</label><textarea id="contact-message" name="message" required placeholder="What are you working on?"></textarea></div>
    <p class="muted">Preview only. This form does not send or store your information.</p>
    <button class="button" type="submit">Preview submission</button>
  </form>
</div>
import decorate from './blocks/contact-form/contact-form.js';
document.querySelectorAll('.contact-form').forEach(decorate);

Variants

Choose a variant in the live preview. Add its class to the authored block.

default

Accessibility & behavior

Every field has a visible label and native validation. The preview does not send data. Remove data-demo and supply a secure server endpoint in your project.

Multiple instances are supported. Layouts adapt to smaller viewports. No npm dependencies are required at runtime.

AEM usage

Copy the canonical CSS and JavaScript into your EDS block folder. Use the same row-and-column authoring structure shown above and let your existing AEM loader call the default decorator.

Compatibility

Standalone verified. EDS markup compatible. Live AEM integration has not been verified.

Edit this example on GitHub

Search documentation

Search the docs, components, and blocks. Use Tab to select a result.