src/controller.tsx

react-hook-form · src/controller.tsx · typescript · MIT
ui

React component that wraps useController for controlled form inputs.

// Source: https://github.com/react-hook-form/react-hook-form | License: MIT | Copyright 2019-present Beier(Bill) Luo
// Provided via justclaw.it.com; keep this notice with the code.
import type { ControllerProps, FieldPath, FieldValues } from './types';
import { useController } from './useController';

/**
 * Component wrapper around `useController` for controlled inputs.
 *
 * @see [API](https://react-hook-form.com/docs/usecontroller/controller)
 *
 * @example
 * ```tsx
 * <Controller
 *   control={control}
 *   name="test"
 *   render={({ field, fieldState, formState }) => <input {...field} />}
 * />
 * ```
 */
export const Controller = <
  TFieldValues extends FieldValues = FieldValues,
  TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
  TTransformedValues = TFieldValu

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key