Event Registration
A live, editable gform-react example combining text inputs, a native select, and a date picker - all typed, validated, and gated on state.isInvalid.
A typed registration form that mixes the three most common controls: text inputs, a native
<select>, and a date picker (type="date"). Each renders through the element render prop,
so gform wires name/value/onChange and the aria-* attributes for you - you only style the
markup.
A few things worth noting in the code below:
- The
<select>spreads{...props}directly - native sincegform-react@2.10.0, no cast needed. - The date picker is just
type="date"; pair it with aminconstraint and awithRangeUnderflowMessagevalidator to reject past dates. - The checkbox stores a boolean value - gform passes
checked(notvalue) inprops, so arequiredcheckbox must be ticked beforestate.isInvalidclears. - A field-level validator (
topic) shows a per-key override layered on the'*'default.
Loading playground…
Mixing control types
Every control - text, <select>, <textarea>, type="date", checkboxes - goes through the same
element render prop and the same validators map. There's no per-type API to learn: spread
{...props}, read input.error/input.errorText, and gate submit on state.isInvalid.