Skip to main content

Registering a custom component (Core)

Package: @formzk/core

Any React component that accepts a value + onChange pair can be registered. This example wires a react-color-style swatch picker — completely custom, yet still benefits from validation, form state, and the declarative API.

Loading playground…

What to try

  • Click a swatch — form state updates, try submitting to see the current values.
  • Remove the declare module augmentation in types/formzk.d.ts — the form still runs (ComponentPropsOf falls back to any), you just lose autocomplete on component="...".
  • Register a second custom component (e.g. a slider) and add a third Formzk.Input bound to it.