TextInput
tetra-ui/text-inputFreeComponent
A component that allows users to enter text.
Live preview
live · rendered by the registry
Rendered by tetra-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://tetra-ui.com/r/text-input.jsonSource
1import { cn } from "@/lib/utils";2import {3 Input,4 type InputAddonChildren,5 InputPressable,6 type InputProps,7 useInputAddons,8 useInputFocusState,9} from "./input";1011// Types12export type TextInputProps = InputProps & {13 onFocus?: () => void;14 onBlur?: () => void;15 disabled?: boolean;16 invalid?: boolean;17 children?: InputAddonChildren;18};1920// Components21export const TextInput = ({22 onFocus,23 onBlur,24 disabled,25 invalid,26 children,27 ...props28}: TextInputProps) => {29 const { isFocused, internalRef, handleFocus, handleBlur, handlePress } =30 useInputFocusState({ onBlur, onFocus });3132 const { startAddons, endAddons, pressableClassName } =33 useInputAddons(children);3435 return (36 <InputPressable37 className={cn("h-12 android:py-0", pressableClassName)}38 disabled={disabled}39 focused={isFocused}40 invalid={invalid}41 onPress={handlePress}42 >43 {startAddons}4445 <Input46 {...props}47 className={cn("h-12 shrink", props.className)}48 disabled={disabled}49 onBlur={handleBlur}50 onFocus={handleFocus}51 pointerEvents={isFocused ? undefined : "none"}52 ref={internalRef}53 />5455 {endAddons}56 </InputPressable>57 );58};
What it pulls in
Other registry items
Files it writes
More from tetra-ui
All 41 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | tetra-ui | Components | Free | 1 dep | |
| Action Inputaction-input | tetra-ui | Components | Free | no deps | |
| Alertalert | tetra-ui | Components | Free | no deps | |
| Avataravatar | tetra-ui | Components | Free | no deps | |
| Badgebadge | tetra-ui | Components | Free | no deps | |
| Bottom Sheetbottom-sheet | tetra-ui | Components | Free | 4 deps · 7 files | |
| Buttonbutton | tetra-ui | Components | Free | no deps | |
| Cardcard | tetra-ui | Components | Free | no deps |
