FieldElementProps

Props to spread onto a field element for integration with Preact form handling.

Definition

  • FieldElementProps
    • name string
    • autofocus boolean
    • ref (element: FieldElement | null) => void
    • onFocus () => void
    • onInput JSX.InputEventHandler<FieldElement>
    • onChange JSX.GenericEventHandler<FieldElement>
    • onBlur () => void

Explanation

onFocus marks the field as touched and runs the configured 'touch' validation, while onBlur runs the configured 'blur' validation. Neither handler uses the event object, so both are typed as () => void and can be passed to native elements or custom components with different focus event types.

Contributors

Thanks to all the contributors who helped make this page better!

  • GitHub profile picture of @fabian-hiller

Partners

Thanks to our partners who support the project ideally and financially.

Sponsors

Thanks to our GitHub sponsors who support the project financially.

  • GitHub profile picture of @vasilii-kovalev
  • GitHub profile picture of @UpwayShop
  • GitHub profile picture of @ruiaraujo012
  • GitHub profile picture of @hyunbinseo
  • GitHub profile picture of @nickytonline
  • GitHub profile picture of @kibertoad
  • GitHub profile picture of @caegdeveloper
  • GitHub profile picture of @Thanaen
  • GitHub profile picture of @bmoyroud
  • GitHub profile picture of @ysknsid25
  • GitHub profile picture of @dslatkin