Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Controller

Component based on useController hook to work with controlled component.

@example
function App() {
  const { control } = useForm<FormValues>({
    defaultValues: {
      test: ""
    }
  });

  return (
    <form>
      <Controller
        control={control}
        name="test"
        render={({ field: { onChange, onBlur, value, ref }, formState, fieldState }) => (
          <>
            <input
              onChange={onChange} // send value to hook form
              onBlur={onBlur} // notify when input is touched
              value={value} // return updated value
              ref={ref} // set ref for focus management
            />
            <p>{formState.isSubmitted ? "submitted" : ""}</p>
            <p>{fieldState.isTouched ? "touched" : ""}</p>
          </>
        )}
      />
    </form>
  );
}
const Controller: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: ControllerProps<TFieldValues, TName>) => import("https://esm.sh/v128/@types/react@18.2.38/index.d.ts").ReactElement<any, string | import("https://esm.sh/v128/@types/react@18.2.38/index.d.ts").JSXElementConstructor<any>>;