Skip to main content

<st-quote-dialog>

JSON type: QuoteDialog

A quote-request dialog: radio cards for the kind of request, then name, e-mail, company, a user count, an optional message and a required consent box. It opens when a window st-quote-open event names its id (st-plan-cards does this on a button click), with that option preselected.

It is a native <dialog> opened with showModal(), so focus is trapped, Esc closes it and the page behind is inert. Closing (Esc, the close button or a click on the backdrop) returns focus to the element that opened it. While open, <html> carries data-st-modal-open (removed on every close and on disconnect), so other fixed page UI such as st-cookie-consent steps aside. Submitting checks the fields, opens a mailto: message to mailto with every answer in the body, dispatches quote-submit and shows success-title / success-text ({option} in the text becomes the chosen option's label). Without mailto nothing is opened and the success state still shows. subject may use {option} (the option's subjectLabel, else its label), {company} and {name}. mailto-note is shown under the success text ({email} becomes the mailto address, as a link) with a button that copies the address, for visitors whose mail app did not open. An empty consent-label leaves out the consent box.

The element's id is the dialog name: set it on the JSON node ("id": "quote"), and point quoteDialog on a st-plan-cards at the same value.

Usage​

import '@sankhyatronics/sankhya-cms/quote-dialog'; // registers <st-quote-dialog>

Properties​

PropertyAttributeTypeDefaultDescription
titletitlestring''Heading of the dialog (an &lt;h2&gt;, named by the dialog).
subtitlesubtitlestring''
options—QuoteOption[][]The radio cards for the kind of request.
optionsLabeloptions-labelstring'Choose an option'
nameLabelname-labelstring'Name'
namePlaceholdername-placeholderstring''
emailLabelemail-labelstring'Email'
emailPlaceholderemail-placeholderstring''
companyLabelcompany-labelstring'Company'
companyPlaceholdercompany-placeholderstring''
countLabelcount-labelstring'Number of users'
countPlaceholdercount-placeholderstring''
messageLabelmessage-labelstring'Message'Label of the optional message box. "(optional)" is appended.
messagePlaceholdermessage-placeholderstring''
consentLabelconsent-labelstring'I agree to be contacted about this request.'
submitLabelsubmit-labelstring'Send request'
successTitlesuccess-titlestring'Thank you'
successTextsuccess-textstring''Shown after submitting. &#123;option&#125; is replaced with the chosen option's label.
closeLabelclose-labelstring'Close'
mailtomailtostring''Recipient of the request e-mail. Without it, submitting opens no e-mail.
subjectsubjectstring'Quote request'Subject of the request e-mail. &#123;option&#125;, &#123;company&#125; and &#123;name&#125; are filled in.
mailtoNotemailto-notestring''Shown under the success text when mailto is set. &#123;email&#125; becomes the address as a link. Empty hides it.
copyLabelcopy-labelstring'Copy address'
copiedLabelcopied-labelstring'Address copied'

Events​

EventDetailDescription
quote-submitCustomEventBubbles and is composed. Detail &#123; option, name, email, company, count, message, consent &#125;.

See the live examples in Storybook.