UNPKG

@kadconsulting/dry

Version:
34 lines (33 loc) 1.47 kB
import type { ReactNode, RefObject, LabelHTMLAttributes } from 'react'; export type InputProps = { /** User-friendly for the input; clicking the label will focus the input */ label: ReactNode; /** An error message to display below the input; displays if a truthy value passed */ error?: ReactNode; /** The contrast color for the label, since it could be presented on a light or dark background. Default: 'light-contrast' */ labelColor?: 'dark-contrast' | 'light-contrast' | string; /** Props to be passed to the element that contains the label, input / textarea, and error */ ContainerProps?: React.HTMLAttributes<HTMLDivElement>; inputTextColor?: string; inputBackgroundColor?: string; }; export interface TextareaProps extends InputProps, React.TextareaHTMLAttributes<HTMLTextAreaElement> { onFocus?: () => void; onBlur?: () => void; readOnly?: boolean; disabled?: boolean; lineNumbers?: boolean; defaultText?: string; tabHandling?: boolean; richTextFormatting?: boolean; asyncValidation?: (value: string) => Promise<string | null>; 'data-testid'?: string; passProps?: object; width?: string | number; /** Props passed to the label element */ LabelProps?: LabelHTMLAttributes<HTMLLabelElement>; /** Optional ref to pass to textarea label */ labelRef?: RefObject<HTMLLabelElement>; /** A string or ReactNode to display as hint text */ HintText?: ReactNode; }