@kform/react
Version:
React integration for KForm.
22 lines (21 loc) • 1.08 kB
TypeScript
import { Path } from "@kform/core";
import * as React from "react";
import { FormatterControllerState } from "../hooks/useFormatter";
import { InputElementProps, InputOptions } from "../hooks/useInput";
/**
* Properties of the {@link Input} component.
*/
export type InputProps<T = unknown, TFormatted = T | undefined, TInput = unknown> = InputOptions<T, TFormatted, TInput> & InputOwnProps<T, TFormatted, TInput>;
/**
* Own properties of the {@link Input} component.
*/
export interface InputOwnProps<T = unknown, TFormatted = T | undefined, TInput = unknown> {
path?: Path | string;
children: (elementProps: InputElementProps<TFormatted, TInput>, state: FormatterControllerState<T, TFormatted>) => React.ReactNode;
}
/**
* Component used to wrap an input so that it "connects" to a form value.
*
* This component is a wrapper around the {@link useInput} hook.
*/
export declare function Input<T = unknown, TFormatted = T | undefined, TInput = unknown>({ path, children, ...props }: InputProps<T, TFormatted, TInput>): import("react/jsx-runtime").JSX.Element;