Genesis

Packages

@marktiderman/genesis-forms-web

0.8.2Primitive · Forms

The web renderer for Genesis Forms: <Form> with one-question-at-a-time and classic layouts, built on Genesis UI components and tokens, accessible by default. Part of the Genesis framework.

The web renderer for Genesis Forms, built on Genesis UI components and tokens.

- **Layouts:** `focus` moves through the respondent's path one question at a time, with Back, a progress bar and Enter to continue (Ctrl/Cmd+Enter in long text; Enter on a focused radio or checkbox too). After a single pick (rating, NPS, yes/no, one choice) it moves on by itself (`autoAdvance={false}` turns it off): only a click, tap or Space counts as a pick, arrow keys just move through the options, and it never moves on from the last question, so Send is always a deliberate press. `classic` shows every visible question; a failed submit focuses an error summary above the fields that links to each invalid one. - **Presentation:** `presentation="embedded"` (the default) is a block inside your own page. `presentation="page"` is the respondent's whole screen, for a QR code or a shared link, Typeform style: it fills the viewport (`min-h-dvh`) with no card around it. In focus layout each question sits centred in a `max-w-xl` column under a thin progress bar pinned to the top edge (it fills with questions answered; "Question N of M" is its `aria-valuetext`). The question is large, the form title introduces only the first question (then stays for assistive tech), and rating, NPS and yes/no become an even grid of large targets. Single and multiple choice rows are full width with a letter key, a filled selected state and a check mark; while focus is in the group, pressing an option's letter picks it. OK is a large primary button with a "press Enter ↵" hint ("Ctrl + Enter" or "⌘ + Enter" in long text) shown only on fine-pointer devices, and Back is a quiet icon button at the top-left. Each new question fades and slides in (CSS `@starting-style`, none with `prefers-reduced-motion`). The ending is centred and large. In classic layout, page mode is one scrolling page, Google Forms style: a header card with the title and description, each question in its own card (red-edged while invalid), Send at the end. `brand={{ name: "Acme", logo }}` shows an organisation's or business's logo (an image URL or an element; its initials without one) and name small at the top of every step and on the ending. Custom slots and renderers can match with `useFormPresentation()`, which returns `{ presentation, layout }`.

pnpm add @marktiderman/genesis-forms-web

READMEChangelognpm

@marktiderman/genesis-forms-web

Components (2)

  • FieldChrome

    Label, description and error around a control. Group types (radio, checkbox list, rating, scale) get a real `fieldset`/`legend`, so a screen reader announces the question with every option; the fieldset carries the field's `inputId` (an ...

  • Form

Hooks (4)

  • useFormPresentation

    The presentation and layout of the enclosing `<Form>`, so a custom slot or renderer can match the built-in ones (larger type and tap targets in page mode, for example). Outside a `<Form>` it reads embedded and classic.

  • useMediaTime

    The enclosing `MediaTimeContext` value, or null.

  • useSourceText

    The enclosing `SourceTextContext` value, or null.

  • useUpload

    The enclosing `UploadContext` value, or null when no host stores files.

Other exports (38)

builtInRenderers · CLASSIC_PROGRESS_DELAY_MS · ConsentField · DateField · DefaultBrand · DefaultEnding · DefaultErrorSummary · DefaultHeader · DefaultNavigation · DefaultProgress · defaultRegistry · describedBy · DropdownField · HIDDEN_QUERY_KEEP_MS · hideQueryOnLoad · ListField · MediaNotesField · MediaTimeContext · MultiChoiceField · NumberField · photoAccept · PhotoField · photoFileProblem · photoFileType · PROGRESS_DELAY_MS · ScaleField · signedUploadHost · SingleChoiceField · SourceTextContext · TableField · TextField · TextHighlightsField · themeColors · themeCss · UPLOAD_WAIT_MESSAGE · UploadContext · wasReload · YesNoField

And 19 types.