Skip to content
Harness Design System Harness Design System Harness Design System

TextInput

The TextInput component is used to handle user input, providing options for styling via themes and sizes. Also offers options for adding icons, captions, custom content, and error text for the field.

Usage

import { TextInput } from '@harnessio/ui/components'
//...
return (
<TextInput
label="Success Input"
id="someinput"
value="input with value"
placeholder="Enter the value"
theme="success"
/>
)

Disable

Read only

Optional

Theme

The TextInput component accepts a theme prop, which defines the visual state of the input: either success, warning, or danger.

When an error occurs, set theme="danger" and pass the error message to the error prop.

For warnings, set theme="warning" and provide the warning message via the warning prop.

Size

The TextInput component accepts a size prop, which defines the overall size of the input field. Available options are md (medium) and sm (small)

Prefix & suffix

The TextInput component supports prefix and suffix props, which allow adding content before or after the input field.

Orientation

The TextInput component accepts an optional orientation prop, which defines the layout direction of the input and its label. Available options are horizontal and vertical (default).

API Reference

interface InformerProps extends Omit<TooltipProps, "children"> {
className?: string;
/**
* If disabled, the tooltip will not be shown
*/
disabled?: boolean;
iconProps?: IconPropsV2;
}
Prop
Required
Default
Type
typefalsetextstring
wrapperClassNamefalsestring
labelfalsestring
captionfalsestring
errorfalsestring
warningfalsestring
optionalfalsefalseboolean
idfalsestring
disabledfalsefalseboolean
classNamefalsestring
inputContainerClassNamefalsestring
themefalse'default''default' | 'success' | 'danger' | 'warning'
sizefalse'md''md' | 'sm'
prefixfalseReactNode
suffixfalseReactNode
valuefalsestring
defaultValuefalsestring
onChangefalseReact.ChangeEventHandler<HTMLInputElement>
placeholderfalsestring
readOnlyfalsefalseboolean
informerContentfalseExclude<ReactNode, boolean | null | undefined>
informerPropsfalseInformerProps
labelSuffixfalseReactNode
orientationfalse'vertical''vertical' | 'horizontal'