@htmlbricks/hb-funnel
v0.76.5
Published
Multi-step funnel over stacked `hb-form` instances: JSON `schemes` supplies one schema per step (or derive step count from `steps`), tracks per-step validity, merges values as the user advances, and optionally shows a final submit step when `submitstep` i
Downloads
7,481
Readme
hb-funnel
Category: forms · Tags: forms, multistep
Summary
Multi-step funnel over hb-form: pass an array of schemas (one per step). Renders one inner form for the active step; valid submit merges values into the step schema and advances or fires final submit.
What it does
- Parse:
schemesas JSON string →parsedSchemes({ schema, valid }[]); then clearsschemesto[]in memory. - Form snapshot:
schemapassed to innerhb-formas JSON string; refreshed when schemes load orstepchanges, not on everyupdate(stable typing). - Navigation: Italian labels — Indietro, Avanti, Salva;
submitsteptogglesyesto trigger inner submit/validation. - Events:
updateon inner form updates (debounced from child) updates current stepvalidonly;submitwhen last step validates.
Custom element
hb-funnel
Attributes
| Attribute | Type (logical) | HTML / notes |
| --- | --- | --- |
| schemes | string | FormSchema[] | JSON: array of schemas (each schema is a FormSchema / array of entries). |
| step | number | string | 1-based index (default 1). |
| steps | number | string | Fallback count before schemes parsed. |
| submitstep | "yes" | "no" | Drives inner submitted; non-yes normalized to no. |
| id | string (optional) | Passed to inner hb-form id pattern. |
| style | string (optional) | In typings. |
Custom events
| Event name | detail shape |
| --- | --- |
| update | { step: number; scheme: { schema: FormSchema; valid: boolean }; valid: boolean } |
| submit | { schemes: { schema: FormSchema; valid: boolean }[]; steps: number; step: number } |
Styling
No dedicated host vars or parts in extra/docs.ts; Bulma --bulma-* via nested hb-form.
Slots
None.
TypeScript
types/webcomponent.type.d.ts — Component, Events, FunnelStepSchemes. Shared FormSchema: builder/src/wc/form/types/webcomponent.type.d.ts.
Minimal HTML example
<hb-funnel
schemes='[[{"type":"text","id":"name","label":"Name","required":true}]]'
></hb-funnel>