reablocks
Version:
Component library for React
77 lines (75 loc) • 1.98 kB
TypeScript
import { InputTheme } from './InputTheme';
import { default as React, RefObject } from 'react';
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
/**
* If true, the input will take up the full width of its container.
*/
fullWidth?: boolean;
/**
* If true, the input will be focused during the first mount.
*/
selectOnFocus?: boolean;
/**
* If true, the input will show an error state.
*/
error?: boolean;
/**
* Additional classname for the input container element.
*/
containerClassname?: string;
/**
* Size of the input.
*/
size?: 'small' | 'medium' | 'large' | string;
/**
* Content to display before the input.
*
* @deprecated Use `startAdornment` instead.
*/
start?: React.ReactNode | string;
/**
* Content to display after the input.
*
* @deprecated Use `endAdornment` instead.
*/
end?: React.ReactNode | string;
/**
* Element to display before the Button content.
*/
startAdornment?: React.ReactNode | string;
/**
* Element to display after the Button content.
*/
endAdornment?: React.ReactNode | string;
/**
* Shortcut for the onChange value event.
*/
onValueChange?: (value: string) => void;
/**
* Theme for the Input.
*/
theme?: InputTheme;
}
export interface InputRef {
/**
* Reference to the input element.
*/
inputRef?: RefObject<HTMLInputElement>;
/**
* Reference to the container element.
*/
containerRef?: RefObject<HTMLDivElement>;
/**
* Method to blur the input.
*/
blur?: () => void;
/**
* Method to focus the input.
*/
focus?: () => void;
/**
* Method to select the input.
*/
select?: () => void;
}
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;