On this page
@addTagHelper *, Webority.Ui.RazorDemo
Open the popup from a button, the way a page does when a visitor asks to be contacted.
Opened by a button
a Talk to our team button opens the popup, and the demo answers its post.
Preview
Preview draws the popup open for a design surface, with no memory, trigger or posting.
Open without a trigger
the popup drawn open with the heading Talk to our team.
Every attribute
One popup with each prop set away from its default, to check how every option looks together.
Every option set
one popup in preview with every prop differing from its default.
Ask for consent
Add the consent field when the enquiry needs a recorded agreement to be contacted. List it in required to block sending until it is ticked.
Consent with a privacy link
a Contact us button opens the popup, and the consent checkbox links to the privacy policy.
Every option
Every value of every prop, one cell each.
action
action="/demo/lead": the URL the form posts to
publicForm
public-form="Lead": the server form name, used as the captcha action
title
title="Talk to our team": the heading and its accessible name
description
(default): no sentence under the heading
description="We reply within one working day."
fields
(default): fields not set, so name and email
fields="name"
fields="email"
fields="phone"
fields="company"
fields="message"
fields="consent"
required
(default): none required
required="name"
required="email"
required="phone"
required="company"
required="message"
required="consent"
consentHref
(default): no privacy link
consent-href="/privacy": a privacy link beside the consent box
fieldPrefix
field-prefix="Input.": text put before every posted field name
fieldNames
field-names="name=full_name": the posted name for a field
labels
labels="name=Your name": the label drawn for a field
maxLengths
max-lengths="name=20": the longest value a field accepts
submitLabel
submit-label="Send" (default): the submit button text
submit-label="Request a call"
successTitle
success-title="Thank you" (default): the heading after a successful send
successText
success-text="A person will call you back.": the sentence under the success heading
errorText
error-text="Something went wrong. Please try again or contact us directly." (default): shown when a send fails
closeLabel
close-label="Close" (default): the close button accessible name
secondaryLabel
(default): no secondary link
secondary-label="Browse the docs first": a link under the form
secondaryHref
secondary-href="/docs": where the secondary link goes
secondaryDivider
secondary-divider="or" (default): the text drawn above the secondary link
secondary-divider="also"
triggers
(default): none, the host calls open()
triggers="exit": opens when the pointer leaves the page
triggers="delay": opens after delay-seconds on the site
triggers="scroll": opens after scroll-percent of the page is scrolled
triggers="pages": opens after pages-viewed pages in one session
delaySeconds
delay-seconds="30" (default): seconds on the site before the delay trigger counts
scrollPercent
scroll-percent="50" (default): percent scrolled before the scroll trigger counts
pagesViewed
pages-viewed="2" (default): pages seen before the pages trigger counts
storageKey
storage-key="lead-matrix": the popup memory in the browser, used with triggers
dismissDays
dismiss-days="30" (default): days a dismissed popup stays quiet
submittedDays
submitted-days="365" (default): days a submitted popup stays quiet
successCloseSeconds
success-close-seconds="5" (default): seconds before the success view closes
preview
preview off (default): closed until open() is called
preview: open with no trigger, memory or posting
onShown
wui-lead-popup-shown: fires when the popup opens, with the trigger that opened it
onBeforeSubmit
wui-lead-popup-before-submit: fires before the post, to add fields to it
onSubmitted
wui-lead-popup-submitted: fires after a successful send
onError
wui-lead-popup-error: fires when a send fails
onClosed
wui-lead-popup-closed: fires when the popup closes, with why it closed
className
class="lead-extra": extra classes on the element (React: className)
Guidance
What to do, and what to avoid.
Use it when
- A public page asks a visitor for their details in a modal, opened by an exit, a delay, a scroll or a page count.
- A campaign page needs a short lead form that is not a section of the page.
Reach for something else when
- The lead form is a section of the page's content. → AppSectionLeadCapture
- The popup is a yes or no question, not a form. → AppConfirmDialog
- The page is inside the signed-in app. → AppModal
Reference
Try every prop, read the full list, and check keyboard and screen reader behaviour.
36 props. The 5 most used come first.
Used on most screens 5 props
| Prop | Type | Default | Description |
|---|---|---|---|
| actiondefault required | url | required | The URL the form posts to. |
| public-formdefault required | string | required | The server's PublicForm name, used as the captcha action. |
| titledefault required | string | required | The dialog's heading, and its accessible name. |
| submit-labeldefault Send | string | Send | The submit button's text. |
| fieldsdefault name,email | list | name,email | The fields in order: name, email, phone, company, message, consent. |
Less common 31 props
| Prop | Type | Default | Description |
|---|---|---|---|
| descriptiondefault - | string | - | A sentence under the heading. |
| success-titledefault Thank you | string | Thank you | The heading after a successful send. |
| success-textdefault - | string | - | The sentence under the success heading. |
| error-textdefault Something went wrong. Please try again or contact us directly. | string | Something went wrong. Please try again or contact us directly. | Shown when the send fails without a message of its own. |
| close-labeldefault Close | string | Close | The close button's accessible name. |
| secondary-labeldefault - | string | - | A secondary link under the form. |
| secondary-hrefdefault - | url | - | Where the secondary link goes. |
| secondary-dividerdefault or | string | or | The text drawn above the secondary link. |
| requireddefault - | list | - | The fields that must have a value. |
| consent-hrefdefault - | string | - | Adds a Privacy policy link beside the consent checkbox, opened in the same tab. |
| field-prefixdefault - | string | - | Text put before every posted field name, such as Input. |
| field-namesdefault - | key=name;key=name | - | Posted name per field, for a server that names it differently. |
| labelsdefault Name, Email, Phone number, Company, Message | key=text;key=text | Name, Email, Phone number, Company, Message | Label per field. |
| max-lengthsdefault name 100, email 320, phone 40, company 150, message 1000 | key=number;key=number | name 100, email 320, phone 40, company 150, message 1000 | Maximum length per field. |
| triggersdefault none | list | none | exit, delay, scroll, pages. Needs a storage-key. |
| storage-keydefault - | string | - | Names the browser memory of the popup. Required with triggers; build it with the user's id. |
| delay-secondsdefault 30 | int | 30 | Seconds on the site before the delay trigger counts as engaged. |
| scroll-percentdefault 50 | int | 50 | Percent of the page scrolled before the scroll trigger counts. |
| pages-vieweddefault 2 | int | 2 | Distinct pages this session before the pages trigger counts. |
| dismiss-daysdefault 30 | int | 30 | Days a dismissed popup stays quiet. |
| submitted-daysdefault 365 | int | 365 | Days a submitted popup stays quiet. |
| success-close-secondsdefault 5 | int | 5 | Seconds before the success view closes. 0 keeps it open. |
| previewdefault false | bool | false | Draw open with no triggers, memory or posting, for a design surface. |
| open(trigger)default - | method | - | Opens the popup. A trigger opens it once per page load and only when memory allows; manual always opens. |
| close(reason)default - | method | - | Closes the popup and returns focus to the element that had it. |
| isOpendefault - | method | - | Whether the popup is open now; setting it to true opens the popup and setting it to false closes it. |
| wui-lead-popup-showndefault - | event | - | Bubbles up when the popup opens, with detail.trigger: exit, delay, scroll, pages or manual. |
| wui-lead-popup-before-submitdefault - | event | - | Bubbles up just before the form posts, with detail.formData, the data about to be sent. |
| wui-lead-popup-submitteddefault - | event | - | Bubbles up after a successful post, with detail.values and detail.response. |
| wui-lead-popup-errordefault - | event | - | Bubbles up when a send fails, with detail.message and detail.reason: gate, network or server. |
| wui-lead-popup-closeddefault - | event | - | Bubbles up when the popup closes, with detail.reason: dismiss, escape, backdrop, submitted or secondary. |
Screen reader
2 notes- The dialog is modal with a heading as its accessible name; Escape and the close button both dismiss it.
- Each field has a visible label and an error message linked by aria-describedby; the first invalid field takes focus.