Skip to main content

TextInput

import { TextInput } from '@tulsa/core';

<TextInput placeholder='Enter Text' />

Props

NameTypeDescriptionDefault
leadingVisualstring | React.ReactElementAn element that will appear on the left side of the input
leadingVisualPropsHTMLProps<"span">Props that will be applied to the root component of the leading visual
trailingVisualstring | React.ReactElementAn element that will appear on the right side of the input
trailingVisualPropsHTMLProps<"span">Props that will be applied to the root component of the trailing visual
leadingAddonReact.ReactElementAn element that will appear before the input's content
trailingAddonReact.ReactElementAn element that will appear after the button's content
rootPropsHTMLProps<"span">Props that are applied to the root of the input
loadingbooleanControls whether a spinner is displayed
asTControls the root element that is used by the input. Can be an HTML element string or a React component

Native props are forwarded to the root component.

Examples

Visuals

$per mi.$
<TextInput placeholder='Enter Text' leadingVisual={"$"} trailingVisual="per mi." />
<TextInput placeholder='Enter Text' leadingVisual={"$"} />

Addons

per mi.
<TextInput placeholder='Search' leadingAddon={<BiSearch className='text-gray-400' />} trailingVisual="per mi." />
<TextInput placeholder='Search' leadingAddon={<BiSearch className='text-gray-400' />} trailingAddon={<BiChevronDown size={18} className='text-gray-400' />} />

Loading

per mi.
<TextInput placeholder='Search' leadingAddon={<BiSearch className='text-gray-400' />} trailingVisual="per mi." loading />