Alpha: Ships on npm at 7.0.0-alpha.07.0.0-alpha.0

cta-form

Copy beside a short form: a plain post, answered with no script.

View as JSON
Variant
From Benchlist › list-a-benchdirectoryOpen the frame

When to use

Use a CTA form when the call is to send something: a question, an intake, an email address. It holds a head, one to eight fields, a submit label of 24 characters and a note of 80, and posts to its action with no script.

Ask only for what the answer needs. When the call is a button or a command, use closing.

Label each field with the noun the reader fills in, and use the note for when an answer comes.

Use instead
  • closing: the call is a button or a command

The record

pages/benchlist/list-a-bench.json, section 2
{
  "kind": "section",
  "shell": { "inset": "contained", "density": "section", "surface": "tint" },
  "block": {
    "type": "cta-form",
    "head": { "eyebrow": "Listing request", "title": "Tell Benchlist about it.", "lede": "Six answers. The tools you name become the listing." },
    "action": "/list-a-bench/sent",
    "fields": [
      { "name": "workshop", "type": "text", "label": "Workshop", "placeholder": "Where the bench is" },
      { "name": "email", "type": "email", "label": "Email", "placeholder": "host@workshop.example" },
      {
        "name": "city",
        "type": "select",
        "label": "City",
        "options": ["Duluth", "Superior", "Two Harbors", "Cloquet", "Another city"]
      },
      {
        "name": "kind",
        "type": "select",
        "label": "Kind",
        "options": ["Kiln room", "Woodshop", "Metal", "Print", "Textile", "Jewelry", "Other"]
      },
      { "name": "rate", "type": "text", "label": "Hourly rate", "placeholder": "$20" },
      { "name": "tools", "type": "textarea", "label": "Tools included", "placeholder": "One tool per line" }
    ],
    "submit": "Send listing",
    "note": "Benchlist takes 12 percent of each booking."
  }
}

Smallest that parses

{
  "type": "cta-form",
  "head": { "eyebrow": "Listing request", "title": "Tell Benchlist about it." },
  "action": "/list-a-bench/sent",
  "fields": [
    { "name": "workshop", "type": "text", "label": "Workshop" }
  ],
  "submit": "Send listing"
}

Fields and bounds

From @mdxui/site@7.0.0-alpha.0. A count reads as min–max × item; a string bound is its maximum length in characters, and links its refusal.

PropType and boundRequired
headobjectyes
head.eyebrowstring ≤28yes
head.titlestring ≤72no
head.ledestring ≤300no
head.maxstring (pattern)no
head.ledeMaxstring (pattern)no
head.balancebooleanno
head.scale"compact" | "large"no
head.tagstring ≤8no
head.layout"split"no
actionstring ≤160yes
fields1–8 × objectyes
fields[].namestring (pattern)yes
fields[].type"text" | "email" | "select" | "textarea"yes
fields[].labelstring ≤16yes
fields[].placeholderstring ≤32no
fields[].options0–12 × string ≤32no
submitstring ≤24yes
notestring ≤80no

Variants and counts

One layout, from 1 field to 8. Field names are lowercase, so the post reads cleanly.

cta-formopen
1 fieldopen
8 fieldsopen

One record in five Themes

directoryBenchlist’s ownopen
certificateopen
vaultlineopen
quaypointopen
callboardopen

Shells

paperopen
tintopen
plateopen
glassopen

In three Businesses

Carried by the contact Template. Seen on pages/benchlist/list-a-bench.json, section 2.

Benchlist › list-a-bench · directoryA directory asks a host for the bench, its city and its price.
Diffkeel › contact · certificateA developer tool asks for an email and the repository host.
Harbor tides › contact · quaypointAn API product asks for a name, an email, a topic and a message.

Do and do not

Doopen
Four fields for a question the harbor answers.
Don’topen
Eight fields to ask a question make the reader do the answer work.
Doopen
Field names in lowercase, like email.
Don’trefused
"name": "Your email"
SectionSchema.safeParse(record)block.fields.0.name10 charactersInvalid string: must match pattern /^[a-z][a-z0-9-]{0,23}$/
A name with a space is refused by its pattern.

Accessibility

Check, on the exemplar renderLimitNowPass
Skipped heading levels00yes
Unnamed nav landmarks00 of 0yes
Scroll regions a keyboard cannot reach00 of 0yes
Copy controls that announce the resultall0 of 0yes
Images and icons with no text alternative00yes

Text pairs below AA across the 5 Themes and every scheme they emit: 5. See Render checks.

  • Landmark The form sits in main. It adds no landmark.
  • Heading level The head title renders as an h2. Every field has a label, and a status region announces the result.
  • Focus order Tab runs the fields in record order, then submit. A hidden trap field takes no focus.