Contact
An inquiry form beside the ways to reach the team, and when to expect an answer.
A contact block is where a visitor writes to the company: a few fields on a sheet, laid out by form, beside the ways to reach the team without it. What it promises is as much a part of it as the fields: who reads the message, and by when they answer.
Contact
<section class="container-inline px-lg py-4xl" data-example="contact" aria-labelledby="contact-title"> <div class="grid gap-2xl items-start max-w(960) mx-auto grid-cols(2)@container(--4xl)"> <div class="flex flex-col gap-xl"> <header class="flex flex-col gap-sm"> <p class="eyebrow">Contact</p> <h2 class="heading heading-2xl" id="contact-title">Talk to the people who run Atlas.</h2> <p class="lead">Tell us what you are deploying. Someone on the team reads every message and answers within one business day.</p> </header> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term">Email</dt> <dd class="data-list-value"> <a class="link" href="mailto:hello@atlas.dev">hello@atlas.dev</a> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Hours</dt> <dd class="data-list-value">Monday to Friday, 09:00 to 18:00 (UTC+8)</dd> </div> <div class="data-list-item"> <dt class="data-list-term">Outages</dt> <dd class="data-list-value"> <a class="link" href="#contact-title">status.atlas.dev</a>, updated within minutes</dd> </div> </dl> </div> <div class="sheet p-xl"> <div data-contact-ask> <form class="form"> <div class="form-row"> <div class="field"> <label for="contact-name">Name</label> <input class="input" id="contact-name" name="name" autocomplete="name" required data-error="contact-name-error"> <span class="field-error" id="contact-name-error">Enter your name.</span> </div> <div class="field"> <label for="contact-email">Email</label> <input class="input" id="contact-email" type="email" name="email" autocomplete="email" placeholder="you@company.com" required data-error="contact-email-error"> <span class="field-error" id="contact-email-error">Enter an email address, such as you@company.com.</span> </div> </div> <div class="field"> <label for="contact-topic">Topic</label> <select class="select" id="contact-topic" name="topic"> <option class="select-option" value="General question">General question</option> <option class="select-option" value="Sales">Sales</option> <option class="select-option" value="Support">Support</option> </select> </div> <div class="field"> <label for="contact-message">Message</label> <textarea class="input input-auto" id="contact-message" name="message" required aria-describedby="contact-message-hint" data-error="contact-message-error"></textarea> <span class="field-hint" id="contact-message-hint">What you are deploying, and where it is stuck.</span> <span class="field-error" id="contact-message-error">Write a message, even a short one.</span> </div> <noscript> <p class="m(0) fg-text-muted">This form needs JavaScript to send. Write to <a class="link" href="mailto:hello@atlas.dev">hello@atlas.dev</a>instead.</p> </noscript> <div class="form-actions"> <button class="btn btn-primary" disabled>Send message</button> </div> </form> </div> <div data-contact-result hidden> <div class="flex flex-col gap-lg"> <div class="alert alert-success"> <svg class="icon alert-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="8" cy="8" r="6" /> <path d="M5 8L7.1041 9.8703A0.2 0.2 0 0 0 7.3832 9.8573L10.75 6.25" /> </svg> <div class="alert-body"> <h3 class="alert-title" tabindex="-1" data-contact-result-title>Message sent</h3> <p class="alert-description">Thanks, <span data-contact-value="name"></span>. We reply to <span data-contact-value="email"></span>within one business day.</p> </div> </div> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term">Topic</dt> <dd class="data-list-value" data-contact-value="topic"></dd> </div> <div class="data-list-item"> <dt class="data-list-term">Message</dt> <dd class="data-list-value whitespace-pre-line" data-contact-value="message"></dd> </div> </dl> <div class="flex"> <button type="button" class="btn" data-contact-edit>Edit message</button> </div> </div> </div> </div> </div></section>/** * A contact form with nowhere to send to. The browser checks the fields: `required` and `type="email"` are the * rules, and the stylesheet shows a field's error once the reader has tried. This module turns the button on, * names each error from its field while it shows, and on a valid submit swaps the form for what was written, * with a way back to change it. Nothing leaves the page: sending is the application's. * Returns the function that stops it and puts the form back. */export function mount(root) { const controller = new AbortController() const { signal } = controller const ask = root.querySelector('[data-contact-ask]') const form = ask.querySelector('.form') const send = form.querySelector('.form-actions .btn') const result = root.querySelector('[data-contact-result]') const title = result.querySelector('[data-contact-result-title]') /** * A field's error is read with the field only while it shows: its id joins aria-describedby, after the hint, * when the browser reports the field, and leaves when the value is valid again. */ const describe = (control, invalid) => { const ids = (control.getAttribute('aria-describedby') ?? '').split(' ').filter(id => id && id !== control.dataset.error) if (invalid) ids.push(control.dataset.error) if (ids.length) control.setAttribute('aria-describedby', ids.join(' ')) else control.removeAttribute('aria-describedby') } for (const control of form.querySelectorAll('[data-error]')) { control.addEventListener('invalid', () => describe(control, true), { signal }) for (const type of ['input', 'change', 'blur']) { control.addEventListener(type, () => describe(control, !control.validity.valid && control.matches(':user-invalid')), { signal }) } } /** `required` is satisfied by a space: a name or a message of spaces alone is refused in the browser's own words. */ for (const control of [form.elements.name, form.elements.message]) { control.addEventListener('input', () => control.setCustomValidity(control.value && !control.value.trim() ? 'Fill in this field.' : ''), { signal }) } const show = (sent) => { ask.hidden = sent result.hidden = !sent } // A submit event means every constraint passed; an invalid form never gets here. form.addEventListener('submit', (event) => { event.preventDefault() const written = new FormData(form) // What was typed is set as text, never as markup. for (const slot of result.querySelectorAll('[data-contact-value]')) slot.textContent = String(written.get(slot.dataset.contactValue)).trim() show(true) title.focus() }, { signal }) result.querySelector('[data-contact-edit]').addEventListener('click', () => { show(false) form.elements.message.focus() }, { signal }) send.disabled = false return () => { controller.abort() send.disabled = true show(false) }}Blocks are markup to copy. They take the page's own text color and size; the previews set fg-text-body text-sm on the body. Each block is a size container, so it reflows by its own width.
#What is in it
- Two columns from 56rem of block.
grid-cols(2)@container(--4xl)sets the words beside the form, anditems-startkeeps each column as tall as what it holds. Below that the words come first, since they say what the form is for. - A promise in the lead. "Within one business day" is the sentence a visitor is looking for. Write the one your team keeps.
- The other ways in are a data list: an address, the hours and where outages are reported. A visitor who would rather write an email than fill a form has not left.
- Four fields. A name, an email, a topic and the message. The name and the email are one
form-row, so they share a line from 28rem of form and stack below it. The topic is a select with a first option that fits most messages, so it never has to be chosen. - Each field is a
fieldthat holds a<label for>and its control, with the hint and the error after them. The hint is tied to the field witharia-describedby; afield-errorshows only while its field is invalid. - One button, at the end, in
form-actions. It isdisabledin the markup and the script turns it on, so a form with no server behind it cannot be sent to the page it stands on. - The result takes the form's place: an alert that says what happens next, what was written as a second data list, and a button that goes back to change it.
#What needs a script
The rules are the browser's: required on three fields and type="email" on one. The stylesheet draws a field as invalid from :user-invalid, which matches only after the reader has edited the field or tried to submit, so nothing is red when the page loads and an error leaves as soon as the value is valid.
main.js does four things. It turns the button on. It adds a field's error to aria-describedby while the error shows and takes it out afterwards, so the message is read with the field and not before. On a valid submit it writes the values into the result as text, shows it and moves focus to its title. "Edit message" brings the form back as it was left, with focus in the message.
It sends nothing. In an application the submit handler posts the form and shows the result when the server answers, or an alert alert-danger with role="alert" when it does not. Without the script the fields, labels and hints are all there, the button stays disabled, and a <noscript> line gives the address to write to.
#Channels
When a form is more than the page needs, list the addresses. Each row of the data list is a team: its address, what to write to it about and how soon it answers. A neutral alert under the list points an outage at the status page, which is faster than any inbox.
Channels
<section class="container-inline px-lg py-4xl" aria-labelledby="contact-channels-title"> <div class="flex flex-col gap-xl max-w(720) mx-auto"> <header class="flex flex-col gap-sm"> <p class="eyebrow">Contact</p> <h2 class="heading heading-2xl" id="contact-channels-title"> Write to the team that can help. </h2> <p class="lead max-w(560)"> Every address is read by the people who do that work, Monday to Friday, 09:00 to 18:00 (UTC+8). </p> </header> <div class="sheet px-lg py-xs"> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term">Sales</dt> <dd class="data-list-value"> <a class="link" href="mailto:sales@atlas.dev">sales@atlas.dev</a><span class="block font-regular fg-text-muted"> Plans, seats and invoices. Answered within one business day. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Support</dt> <dd class="data-list-value"> <a class="link" href="mailto:support@atlas.dev">support@atlas.dev</a><span class="block font-regular fg-text-muted"> A build, a domain or a deployment that misbehaves. Pro workspaces hear back by the next day. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Security</dt> <dd class="data-list-value"> <a class="link" href="mailto:security@atlas.dev">security@atlas.dev</a><span class="block font-regular fg-text-muted"> Report a vulnerability. Acknowledged within 24 hours, every day of the week. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Press</dt> <dd class="data-list-value"> <a class="link" href="mailto:press@atlas.dev">press@atlas.dev</a><span class="block font-regular fg-text-muted"> Interviews, logos and facts about the company. </span> </dd> </div> </dl> </div> <div class="alert"> <svg class="icon alert-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <circle cx="8" cy="8" r="6" /><circle cx="8" cy="5" r="0.5" fill="currentColor" stroke="none" /><path d="M8 8L8 11" /> </svg> <div class="alert-body"> <p class="alert-title">Is something down?</p> <p class="alert-description"> Incidents are posted on the status page within minutes, before anyone reads an inbox. </p> </div> <a class="btn btn-sm" href="#contact-channels-title">Open status</a> </div> </div></section>import InfoCircleIcon from '@master/icons-react/native/16/soft/info-circle'<section className="container-inline px-lg py-4xl" aria-labelledby="contact-channels-title"> <div className="flex flex-col gap-xl max-w(720) mx-auto"> <header className="flex flex-col gap-sm"> <p className="eyebrow">Contact</p> <h2 className="heading heading-2xl" id="contact-channels-title"> Write to the team that can help. </h2> <p className="lead max-w(560)"> Every address is read by the people who do that work, Monday to Friday, 09:00 to 18:00 (UTC+8). </p> </header> <div className="sheet px-lg py-xs"> <dl className="data-list"> <div className="data-list-item"> <dt className="data-list-term">Sales</dt> <dd className="data-list-value"> <a className="link" href="mailto:sales@atlas.dev">sales@atlas.dev</a><span className="block font-regular fg-text-muted"> Plans, seats and invoices. Answered within one business day. </span> </dd> </div> <div className="data-list-item"> <dt className="data-list-term">Support</dt> <dd className="data-list-value"> <a className="link" href="mailto:support@atlas.dev">support@atlas.dev</a><span className="block font-regular fg-text-muted"> A build, a domain or a deployment that misbehaves. Pro workspaces hear back by the next day. </span> </dd> </div> <div className="data-list-item"> <dt className="data-list-term">Security</dt> <dd className="data-list-value"> <a className="link" href="mailto:security@atlas.dev">security@atlas.dev</a><span className="block font-regular fg-text-muted"> Report a vulnerability. Acknowledged within 24 hours, every day of the week. </span> </dd> </div> <div className="data-list-item"> <dt className="data-list-term">Press</dt> <dd className="data-list-value"> <a className="link" href="mailto:press@atlas.dev">press@atlas.dev</a><span className="block font-regular fg-text-muted"> Interviews, logos and facts about the company. </span> </dd> </div> </dl> </div> <div className="alert"> <InfoCircleIcon className="icon alert-icon" /> <div className="alert-body"> <p className="alert-title">Is something down?</p> <p className="alert-description"> Incidents are posted on the status page within minutes, before anyone reads an inbox. </p> </div> <a className="btn btn-sm" href="#contact-channels-title">Open status</a> </div> </div></section><script> import InfoCircleIcon from '@master/icons-svelte/native/16/soft/info-circle'</script><section class="container-inline px-lg py-4xl" aria-labelledby="contact-channels-title"> <div class="flex flex-col gap-xl max-w(720) mx-auto"> <header class="flex flex-col gap-sm"> <p class="eyebrow">Contact</p> <h2 class="heading heading-2xl" id="contact-channels-title"> Write to the team that can help. </h2> <p class="lead max-w(560)"> Every address is read by the people who do that work, Monday to Friday, 09:00 to 18:00 (UTC+8). </p> </header> <div class="sheet px-lg py-xs"> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term">Sales</dt> <dd class="data-list-value"> <a class="link" href="mailto:sales@atlas.dev">sales@atlas.dev</a><span class="block font-regular fg-text-muted"> Plans, seats and invoices. Answered within one business day. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Support</dt> <dd class="data-list-value"> <a class="link" href="mailto:support@atlas.dev">support@atlas.dev</a><span class="block font-regular fg-text-muted"> A build, a domain or a deployment that misbehaves. Pro workspaces hear back by the next day. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Security</dt> <dd class="data-list-value"> <a class="link" href="mailto:security@atlas.dev">security@atlas.dev</a><span class="block font-regular fg-text-muted"> Report a vulnerability. Acknowledged within 24 hours, every day of the week. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Press</dt> <dd class="data-list-value"> <a class="link" href="mailto:press@atlas.dev">press@atlas.dev</a><span class="block font-regular fg-text-muted"> Interviews, logos and facts about the company. </span> </dd> </div> </dl> </div> <div class="alert"> <InfoCircleIcon class="icon alert-icon" /> <div class="alert-body"> <p class="alert-title">Is something down?</p> <p class="alert-description"> Incidents are posted on the status page within minutes, before anyone reads an inbox. </p> </div> <a class="btn btn-sm" href="#contact-channels-title">Open status</a> </div> </div></section><script setup>import InfoCircleIcon from '@master/icons-vue/native/16/soft/info-circle'</script><template> <section class="container-inline px-lg py-4xl" aria-labelledby="contact-channels-title"> <div class="flex flex-col gap-xl max-w(720) mx-auto"> <header class="flex flex-col gap-sm"> <p class="eyebrow">Contact</p> <h2 class="heading heading-2xl" id="contact-channels-title"> Write to the team that can help. </h2> <p class="lead max-w(560)"> Every address is read by the people who do that work, Monday to Friday, 09:00 to 18:00 (UTC+8). </p> </header> <div class="sheet px-lg py-xs"> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term">Sales</dt> <dd class="data-list-value"> <a class="link" href="mailto:sales@atlas.dev">sales@atlas.dev</a><span class="block font-regular fg-text-muted"> Plans, seats and invoices. Answered within one business day. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Support</dt> <dd class="data-list-value"> <a class="link" href="mailto:support@atlas.dev">support@atlas.dev</a><span class="block font-regular fg-text-muted"> A build, a domain or a deployment that misbehaves. Pro workspaces hear back by the next day. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Security</dt> <dd class="data-list-value"> <a class="link" href="mailto:security@atlas.dev">security@atlas.dev</a><span class="block font-regular fg-text-muted"> Report a vulnerability. Acknowledged within 24 hours, every day of the week. </span> </dd> </div> <div class="data-list-item"> <dt class="data-list-term">Press</dt> <dd class="data-list-value"> <a class="link" href="mailto:press@atlas.dev">press@atlas.dev</a><span class="block font-regular fg-text-muted"> Interviews, logos and facts about the company. </span> </dd> </div> </dl> </div> <div class="alert"> <InfoCircleIcon class="icon alert-icon" /> <div class="alert-body"> <p class="alert-title">Is something down?</p> <p class="alert-description"> Incidents are posted on the status page within minutes, before anyone reads an inbox. </p> </div> <a class="btn btn-sm" href="#contact-channels-title">Open status</a> </div> </div> </section></template>The list keeps the measure of one column of reading, max-w(720). Under 20rem of list each team's name moves above its address, which is the data list's own doing.
#Accessibility
- The block is a
<section>named by its<h2>. The result's title is an<h3>withtabindex="-1": focus moves to it when the result appears, so a screen reader starts at the answer and the keyboard continues from there. - Every field has a visible label and an
autocompletevalue:nameandemailare what let the browser fill them in. - An error is words beside its field, in the field's
aria-describedbywhile it shows. Each one says what to do: "Enter an email address, such as [email protected]." - A failed submit keeps the browser's own behavior: focus goes to the first field that is wrong.
- The button is disabled only until the script is ready, never while the form is merely incomplete. A disabled button cannot say what is missing; a submitted form can.
- An address is a
mailto:link whose text is the address, so it can be read, copied and followed.
#Related
- FormThe rhythm of a form: rows, sections and actions that follow their column.
- InputText fields cut into the surface, with labels, hints, errors and groups.
- SelectA native select whose option list is drawn in the same material.
- ButtonA raised control that lifts on hover and sinks when pressed.
- AlertA message in the flow of the page, with an optional status.
- Data listThe facts about one thing, as terms and values.
- SurfaceTrays, sheets and wells: the material ladder every component is built on.
- HeadingA title in the ink of the page, with the line over it and the paragraph under it.
- LinkText that goes somewhere, in the ink of its sentence.