0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
Contact form patterns with split layouts, contact information sidebars, and map integration. Accessible and responsive designs for customer communication.
Overview
Contact forms are essential for user communication. These patterns demonstrate various layouts from simple centered forms to complex split designs with contact information and map placeholders.
Key features:
<form-field> for consistent input styling and validation
<textarea> with appropriate rowsattribute for message input
<layout-sidebar> for split layouts with contact information
<layout-card> as the form surface
<address> wrapping a <dl data-variant="horizontal"> for contact details and opening hours
<icon-wc> for visual contact method indicators
Proper autocomplete attributes for form autofill
Accessible validation with <output> and aria-live
Simple Contact Form
A centered contact form using data-layout="cover" for vertical centering. Includes name, email, and message fields with validation support.
<bodydata-layout="cover"data-layout-min="xl"data-layout-padding="l"><layout-carddata-max="narrow"data-padding="l"data-layout-principal><formaction="/contact"method="POST"data-layout="stack"data-layout-gap="l"><headerdata-layout="stack"data-layout-gap="s"><h1>Get in touch</h1><p>We'd love to hear from you. Send us a message and we'll respond as soon as possible.</p></header><form-field><labelfor="name">Name</label><inputtype="text"id="name"name="name"requiredautocomplete="name"placeholder="Your name"aria-describedby="name-error"/><outputid="name-error"class="error"for="name"aria-live="polite"> Please enter your name.</output></form-field><form-field><labelfor="email">Email</label><inputtype="email"id="email"name="email"requiredautocomplete="email"placeholder="[email protected]"aria-describedby="email-error"/><outputid="email-error"class="error"for="email"aria-live="polite"> Please enter a valid email address.</output></form-field><form-field><labelfor="message">Message</label><textareaid="message"name="message"rows="5"requiredplaceholder="How can we help you?"aria-describedby="message-error"></textarea><outputid="message-error"class="error"for="message"aria-live="polite"> Please enter a message.</output></form-field><buttontype="submit">Send message</button></form></layout-card></body>
Split Layout with Contact Info
A two-column layout using <layout-sidebar> with the form in a <layout-card> as the main content and contact information in the sidebar. Address, phone and email sit in an <address> as a horizontal description list; business hours use the same list. The list keeps label and value side by side even in the narrow sidebar, and only stacks below 16rem.
<bodydata-layout="cover"data-layout-min="xl"data-layout-padding="xl"><maindata-layout="center"data-layout-max="wide"data-layout-gap="2xl"data-layout-principal><layout-sidebardata-layout-gap="2xl"data-layout-sidebar-width="narrow"data-layout-content-min="m"><!-- Form Panel --><layout-carddata-padding="l"><formaction="/contact"method="POST"data-layout="stack"data-layout-gap="l"><headerdata-layout="stack"data-layout-gap="s"><h1>Send us a message</h1><p>Fill out the form and our team will get back to you within 24 hours.</p></header><form-field><labelfor="name">Name</label><inputtype="text"id="name"name="name"requiredautocomplete="name"placeholder="Your name"aria-describedby="name-error"/><outputid="name-error"class="error"for="name"aria-live="polite"> Please enter your name.</output></form-field><form-field><labelfor="email">Email</label><inputtype="email"id="email"name="email"requiredautocomplete="email"placeholder="[email protected]"aria-describedby="email-error"/><outputid="email-error"class="error"for="email"aria-live="polite"> Please enter a valid email address.</output></form-field><form-field><labelfor="subject">Subject</label><inputtype="text"id="subject"name="subject"requiredplaceholder="What is this regarding?"aria-describedby="subject-error"/><outputid="subject-error"class="error"for="subject"aria-live="polite"> Please enter a subject.</output></form-field><form-field><labelfor="message">Message</label><textareaid="message"name="message"rows="5"requiredplaceholder="Tell us more about your inquiry..."aria-describedby="message-error"></textarea><outputid="message-error"class="error"for="message"aria-live="polite"> Please enter a message.</output></form-field><buttontype="submit">Send message</button></form></layout-card><!-- Contact Info Sidebar --><asideclass="contact-info"data-layout="stack"data-layout-gap="xl"><headerdata-layout="stack"data-layout-gap="m"><h2>Contact information</h2><p>Reach out to us through any of these channels.</p></header><address><dldata-variant="horizontal"><div><dt><icon-wcname="map-pin"></icon-wc> Address</dt><dd> 123 Business Ave, Suite 100<br/> San Francisco, CA 94102</dd></div><div><dt><icon-wcname="phone"></icon-wc> Phone</dt><dd><ahref="tel:+14155551234">(415) 555‑1234</a></dd></div><div><dt><icon-wcname="mail"></icon-wc> Email</dt><dd><ahref="mailto:[email protected]">[email protected]</a></dd></div></dl></address><sectiondata-layout="stack"data-layout-gap="m"><h2>Business hours</h2><dldata-variant="horizontal"><div><dt>Monday - Friday</dt><dd>9:00 AM - 6:00 PM</dd></div><div><dt>Saturday</dt><dd>10:00 AM - 4:00 PM</dd></div><div><dt>Sunday</dt><dd>Closed</dd></div></dl></section></aside></layout-sidebar></main></body>
Contact Info Styles
Contact information styling
body {margin: 0;background: var(--color-surface-raised);}/* Contact info sidebar: bespoke look for the address and hours lists */.contact-infoh2 {font-size: var(--font-size-l);}.contact-info:is(p, dd) {color: var(--color-text-muted);}.contact-infoaddress {font-style: normal;}.contact-infodt {font-weight: var(--font-weight-medium);}.contact-infodd {font-size: var(--font-size-s);}.contact-infodticon-wc {color: var(--color-interactive);}.contact-infodda {color: inherit;text-decoration: none;}.contact-infodda:hover {color: var(--color-interactive);}
With Map
Contact form with a <geo-map> component for displaying your location. Uses a centered header above a split layout with free OpenStreetMap tiles.
<bodydata-layout="cover"data-layout-min="xl"data-layout-padding="xl"><maindata-layout="center"data-layout-max="wide"data-layout-gap="2xl"data-layout-principal><!-- Header --><headerdata-layout="center"data-layout-textdata-layout-gap="s"><h1>Contact us</h1><p>Have questions? We're here to help. Send us a message or visit our office.</p></header><!-- Content Grid --><layout-sidebardata-layout-gap="xl"data-layout-sidebar-width="wide"data-layout-content-min="m"><!-- Contact Form --><layout-carddata-padding="l"><formaction="/contact"method="POST"data-layout="stack"data-layout-gap="l"><h2>Send a message</h2><layout-griddata-layout-min="xs"data-layout-gap="m"><form-field><labelfor="first-name">First name</label><inputtype="text"id="first-name"name="first_name"requiredautocomplete="given-name"placeholder="John"aria-describedby="first-name-error"/><outputid="first-name-error"class="error"for="first-name"aria-live="polite"> Please enter your first name.</output></form-field><form-field><labelfor="last-name">Last name</label><inputtype="text"id="last-name"name="last_name"requiredautocomplete="family-name"placeholder="Doe"aria-describedby="last-name-error"/><outputid="last-name-error"class="error"for="last-name"aria-live="polite"> Please enter your last name.</output></form-field></layout-grid><form-field><labelfor="email">Email</label><inputtype="email"id="email"name="email"requiredautocomplete="email"placeholder="[email protected]"aria-describedby="email-error"/><outputid="email-error"class="error"for="email"aria-live="polite"> Please enter a valid email address.</output></form-field><form-field><labelfor="phone">Phone (optional)</label><inputtype="tel"id="phone"name="phone"autocomplete="tel"placeholder="(555) 123-4567"/></form-field><form-field><labelfor="message">Message</label><textareaid="message"name="message"rows="4"requiredplaceholder="How can we help you?"aria-describedby="message-error"></textarea><outputid="message-error"class="error"for="message"aria-live="polite"> Please enter a message.</output></form-field><buttontype="submit">Send message</button></form></layout-card><!-- Map Sidebar --><aside><geo-maplat="37.7749"lng="-122.4194"zoom="14"><address> 123 Business Ave, Suite 100<br/> San Francisco, CA 94102</address></geo-map></aside></layout-sidebar></main></body>
Map Styles
Map styling
body {margin: 0;}aside geo-map {--geo-map-height: 100%;min-height: 400px;}