@htmlbricks/hb-form-contact
v0.71.16
Published
Opinionated contact form: JSON `informations` toggles and labels fields (name, email, phone, subject, message, etc.) and builds the `hb-form` schema at runtime, including privacy-policy checkbox from `privacy_policy`. Optional `captcha` config embeds `hb-
Readme
hb-form-contact — form-contact
Category: forms
Tags: forms, contact
What it does
Opinionated contact form: JSON informations toggles and labels fields (name, email, phone, subject, message, etc.) and builds the hb-form schema at runtime, including privacy-policy checkbox from privacy_policy. Optional captcha config embeds hb-captcha-google-recaptcha-v2-invisible before submit; success UI uses Svelte transitions.
Custom element
hb-form-contact
Attributes (snake_case; use string values in HTML)
id— optional stringstyle— optional stringinformations— optional string (JSON: which fields exist and theirrequired,label,placeholder,value)privacy_policy— optional string (JSON:input,link?,policyId?,required?)captcha— optional string (JSON:typegooglev_recaptchav2_invisible|googlev_recaptchav3,siteKey)
Events
formContactSubmit—{ _valid: boolean; values: Record<string, string | number | boolean> }formContactSubmitWithCaptcha— same as above plusresponse: string
Usage notes
CSS part: container. Bootstrap theme variables apply via component styles.
Minimal HTML example
<hb-form-contact
informations="{"email":{"required":true},"message":{}}"
privacy_policy="{"input":"I agree","required":true}"
></hb-form-contact>