@primer/react
Version:
An implementation of GitHub's Primer Design System using React
47 lines (46 loc) • 2.38 kB
TypeScript
import React from 'react';
import { ForwardRefComponent as PolymorphicForwardRefComponent } from '../utils/polymorphic';
import { Merge } from '../utils/types';
import { StyledWrapperProps } from '../_TextInputWrapper';
export type TextInputNonPassthroughProps = {
/** @deprecated Use `leadingVisual` or `trailingVisual` prop instead */
icon?: React.ComponentType<React.PropsWithChildren<{
className?: string;
}>>;
/** Whether the to show a loading indicator in the input */
loading?: boolean;
/**
* Which position to render the loading indicator
* 'auto' (default): at the end of the input, unless a `leadingVisual` is passed. Then, it will render at the beginning
* 'leading': at the beginning of the input
* 'trailing': at the end of the input
**/
loaderPosition?: 'auto' | 'leading' | 'trailing';
/**
* A visual that renders inside the input before the typing area
*/
leadingVisual?: string | React.ComponentType<React.PropsWithChildren<{
className?: string;
}>>;
/**
* A visual that renders inside the input after the typing area
*/
trailingVisual?: string | React.ComponentType<React.PropsWithChildren<{
className?: string;
}>>;
/**
* A visual that renders inside the input after the typing area
*/
trailingAction?: React.ReactElement<React.HTMLProps<HTMLButtonElement>>;
} & Pick<StyledWrapperProps, 'block' | 'contrast' | 'disabled' | 'monospace' | 'sx' | 'width' | 'maxWidth' | 'minWidth' | 'variant' | 'size' | 'validationStatus'>;
export type TextInputProps = Merge<React.ComponentPropsWithoutRef<'input'>, TextInputNonPassthroughProps>;
declare const _default: PolymorphicForwardRefComponent<"input", TextInputProps> & {
Action: React.ForwardRefExoticComponent<Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "aria-label" | "size" | "tooltipDirection"> & {
children?: React.ReactNode;
"aria-label"?: string | undefined;
tooltipDirection?: "s" | "ne" | "e" | "se" | "sw" | "w" | "n" | "nw" | undefined;
icon?: React.FunctionComponent<React.PropsWithChildren<import("@primer/octicons-react/dist/icons").IconProps>> | undefined;
variant?: import("../Button/types").VariantType | undefined;
} & import("..").SxProp & React.RefAttributes<HTMLButtonElement>>;
};
export default _default;