Types: StoreFormProps to ContactFormProps
The types of @poltura/theme-sdk/forms, StoreFormProps to ContactFormProps.
Ezen az oldalon
import { … } from '@poltura/theme-sdk/forms';StoreFormProps
Props of StoreForm.
handlerequiredstringThe handle of the published form, such as `contact`.
childrenReactNodeYour own fields and buttons; the form's fields and send button when omitted.
layoutStoreFormLayoutHow the fields sit.
appearanceStoreFormAppearanceThe surface the form draws on.
chromeStoreFormChromeWhether the title and card draw; `full` when omitted.
copyStoreFormCopyThe theme's own wording.
fieldVisibilityReadonly<Record<string, boolean>>Fields to hide or show by field id, over the merchant's settings.
emailHintsbooleanShows deliverability hints under email fields; a domain that takes no mail blocks sending.
onAccepted(submissionId: string, preview: boolean) => voidCalled once the store accepted a submission; `preview` is true in the customizer.
classNamestringClasses added to the form's card.
FormFieldRender
What a FormField render function receives.
fieldrequiredStoreFormFieldViewThe field.
valuerequiredFormValueThe field's value.
errorrequiredstring | nullThe field's error, or null.
describedByrequiredstringThe id of the error line, for `aria-describedby`.
setValuerequired(value: FormValue) => voidSets the field's value.
FormFieldProps
Props of FormField.
idrequiredstringThe field id.
children(field: FormFieldRender) => ReactNodeDraws your own control; the platform control when omitted.
FieldControlProps
Props of FieldControl.
fieldrequiredStoreFormFieldViewThe field to draw.
valuerequiredFormValueThe field's value.
errorstring | nullThe error to show, or null.
disabledbooleanWhether the control is disabled.
onChangerequired(value: FormValue) => voidCalled with the new value.
SubmitButtonProps
Props of SubmitButton.
childrenReactNodeThe label; the form's send or next-step wording when omitted.
classNamestringClasses added to the button.
FormDisplay
Whether a form opens as a dialog or as a side panel.
type FormDisplay = 'popup' | 'drawer'FormWidth
How wide an opened form is.
type FormWidth = 'compact' | 'standard' | 'wide'OpenFormInput
A form to open in a dialog or side panel.
handlerequiredstringThe handle of the published form.
displayFormDisplayDialog or side panel; `popup` when omitted.
widthFormWidthHow wide it opens; `standard` when omitted.
layoutStoreFormLayoutHow the fields sit.
appearanceStoreFormAppearanceThe surface the form draws on.
FormActions
The actions that open a published form over the page.
openFormrequired(input: OpenFormInput, trigger?: HTMLElement | null) => voidOpens the form; focus returns to `trigger` when it closes.
preloadFormrequired(handle: string) => voidStarts loading a form, so it opens without a wait.
FormTriggerProps
Props of FormTrigger.
handlerequiredstringThe handle of the published form.
displayFormDisplayDialog or side panel; `popup` when omitted.
widthFormWidthHow wide it opens; `standard` when omitted.
layoutStoreFormLayoutHow the fields sit.
appearanceStoreFormAppearanceThe surface the form draws on.
childrenReactNodeThe button label.
classNamestringClasses added to the button.
FormPopupFrequency
How often a form that opens by itself opens again for one visitor: once ever, once a session, or after 30 days.
type FormPopupFrequency = 'once' | 'session' | 'days'FormPopupProps
Props of FormPopup.
handlerequiredstringThe handle of the published form.
displayFormDisplayDialog or side panel; `popup` when omitted.
widthFormWidthHow wide it opens; `standard` when omitted.
layoutStoreFormLayoutHow the fields sit.
appearanceStoreFormAppearanceThe surface the form draws on.
delaySecondsrequirednumberSeconds after the page opens before the form does; at least 5.
frequencyrequiredFormPopupFrequencyHow often it opens again for the same visitor.
NewsletterTexts
The newsletter wording, from the theme settings over the platform's own, and the store's consent sentence.
headingrequiredstringThe heading.
descriptionrequiredstringThe line under the heading.
buttonrequiredstringThe sign-up button.
consentrequiredstringThe store's marketing consent sentence; theme settings do not change it.
NewsletterState
Whether the store takes newsletter sign-ups, and the wording to ask with.
enabledrequiredbooleanWhether the store collects newsletter sign-ups.
visiblerequiredbooleanWhether the theme shows the newsletter; false when the merchant switched it off in the theme.
doubleOptInrequiredbooleanWhether a sign-up must confirm by email before it counts.
formHandlerequiredstringThe handle of the newsletter form.
textsrequiredNewsletterTextsThe wording in the page language.
NewsletterLayout
Where a newsletter form sits, which decides its look.
type NewsletterLayout = 'inline' | 'stacked' | 'footer' | 'section'NewsletterFormProps
Props of NewsletterForm.
layoutNewsletterLayout`inline` and `stacked` draw the form alone; `footer` adds the footer heading, `section` a full-width band.
appearanceStoreFormAppearanceThe surface the form draws on, for `inline` and `stacked`.
chromeStoreFormChromeWhether the title and card draw, for `inline` and `stacked`.
copyStoreFormCopyThe theme's own wording, for `inline` and `stacked`.
onAccepted(submissionId: string, preview: boolean) => voidCalled once a sign-up was accepted; `preview` is true in the customizer.
classNamestringClasses added to the form.
NewsletterTriggerProps
Props of NewsletterTrigger.
displayFormDisplayDialog or side panel; `popup` when omitted.
widthFormWidthHow wide it opens.
childrenReactNodeThe button label.
classNamestringClasses added to the button.
ContactFormProps
Props of ContactForm; every wording falls back to the platform's own.
formTitlestringThe form title.
formSubtitlestringThe line under the title.
showNamebooleanWhether the name field shows; true when omitted.
showSubjectbooleanWhether the subject field shows; true when omitted.
nameLabelstringThe name label.
namePlaceholderstringThe name placeholder.
emailLabelstringThe email label.
emailPlaceholderstringThe email placeholder.
subjectLabelstringThe subject label.
subjectPlaceholderstringThe subject placeholder.
messageLabelstringThe message label.
messagePlaceholderstringThe message placeholder.
submitLabelstringThe send button.
successTitlestringThe heading after sending.
successMessagestringThe message after sending.
newMessageLabelstringThe button that starts a new message.