Loading...
Loading...
Build single-line and multi-line text input fields using Syncfusion React TextBox. Trigger when user needs text inputs with floating labels, validation states, adornments (icons/buttons via prependTemplate/appendTemplate), sizing options, rounded corners (e-corner), disabled/read-only states, RTL support, or custom styling. Use for forms, user profiles, search bars, comments, addresses, or any text data collection in React applications.
npx skill4agent add syncfusion/react-ui-components-skills syncfusion-react-textbox🛑 Agentic use: Do not execute multiple steps autonomously. Confirm with the user before each action (install, run, file creation).
@syncfusion/ej2-react-inputsnpm install @syncfusion/ej2-react-inputs@syncfusion/ej2-react-inputs@28.x.xnpm auditnpm run devaddIcon()showClearButtone-cornerenabled={false}e-smalle-biggercssClasse-cornermultiline={true}htmlAttributes={{ maxlength: '...' }}cssClasse-errore-warninge-successenabled={false}disabledreadonly={true}inputprependTemplateappendTemplateuseStateuseEffectuseRefuseReducerenableRtlplaceholderfloatLabelTypevaluetypecssClassmultilineshowClearButtonenabledreadonlyenableRtlenablePersistenceautocompletehtmlAttributeslocalewidthprependTemplateappendTemplateaddIconaddAttributesremoveAttributesfocusInfocusOutdestroygetPersistDatacreateddestroyedchangeinputfocusblurimport { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
import './App.css';
export default function App() {
return (
<TextBoxComponent
placeholder="Enter your name"
floatLabelType="Auto"
/>
);
}import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
import { useRef } from 'react';
export default function App() {
const textboxRef = useRef(null);
const handleCreate = () => {
if (textboxRef.current) {
textboxRef.current.addIcon('append', 'e-icons e-input-popup-date');
}
};
return (
<TextBoxComponent
placeholder="Enter date"
floatLabelType="Auto"
ref={textboxRef}
created={handleCreate}
/>
);
}import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
export default function App() {
return (
<TextBoxComponent
placeholder="Enter your email"
floatLabelType="Auto"
showClearButton={true}
/>
);
}import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
export default function App() {
return (
<TextBoxComponent
multiline={true}
placeholder="Enter your address"
floatLabelType="Auto"
/>
);
}import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
import { useState } from 'react';
export default function ValidationForm() {
const [cssClass, setCssClass] = useState('');
return (
<div>
<TextBoxComponent
placeholder="Enter username"
cssClass={cssClass}
floatLabelType="Auto"
input={(e: any) => {
if (!e.value) setCssClass('');
else if (e.value.length < 3) setCssClass('e-error');
else if (e.value.length < 6) setCssClass('e-warning');
else setCssClass('e-success');
}}
/>
</div>
);
}import * as React from 'react';
import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
import { useRef, useState } from 'react';
export default function PasswordInput() {
const textboxRef = useRef<TextBoxComponent>(null);
const [isVisible, setIsVisible] = useState(false);
const toggleVisibility = () => {
if (textboxRef.current) {
const newVisibility = !isVisible;
textboxRef.current.type = newVisibility ? 'text' : 'password';
setIsVisible(newVisibility);
}
};
function appendTemplate(): JSX.Element {
return (
<>
<span className="e-input-separator"></span>
<span
className={`e-icons ${isVisible ? 'e-eye-slash' : 'e-eye'}`}
onClick={toggleVisibility}
style={{ cursor: 'pointer' }}
></span>
</>
);
}
return (
<TextBoxComponent
ref={textboxRef}
type="password"
placeholder="Enter password"
floatLabelType="Auto"
appendTemplate={appendTemplate}
/>
);
}import * as React from 'react';
import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
export default function EmailInput() {
function prependTemplate(): JSX.Element {
return (
<>
<span className="e-icons e-user"></span>
<span className="e-input-separator"></span>
</>
);
}
function appendTemplate(): JSX.Element {
return (
<>
<span className="e-input-separator"></span>
<span>.com</span>
</>
);
}
return (
<TextBoxComponent
type="email"
placeholder="Enter email"
floatLabelType="Auto"
prependTemplate={prependTemplate}
appendTemplate={appendTemplate}
/>
);
}import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
export default function RoundedCornerTextBox() {
return (
<TextBoxComponent
placeholder="Enter Date"
cssClass="e-corner"
/>
);
}import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
export default function DisabledTextBox() {
return (
<TextBoxComponent
placeholder="Enter Name"
enabled={false}
/>
);
}import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
export default function RTLTextBox() {
return (
<TextBoxComponent
placeholder="أدخل اسمك"
floatLabelType="Auto"
enableRtl={true}
/>
);
}import { TextBoxComponent } from '@syncfusion/ej2-react-inputs';
import { useRef } from 'react';
export default function AutoSizeTextbox() {
const textboxRef = useRef(null);
const handleInput = () => {
if (textboxRef.current) {
const elem = textboxRef.current.respectiveElement;
elem.style.height = 'auto';
elem.style.height = elem.scrollHeight + 'px';
}
};
const handleCreate = () => {
if (textboxRef.current) {
textboxRef.current.addAttributes({ rows: 1 });
}
handleInput();
};
return (
<TextBoxComponent
multiline={true}
placeholder="Enter your message"
floatLabelType="Auto"
ref={textboxRef}
created={handleCreate}
input={handleInput}
/>
);
}| Property | Type | Purpose |
|---|---|---|
| | Hint text shown when input is empty |
| | Label animation behavior |
| | Sets the content of the TextBox |
| | Input type ( |
| | Convert to textarea for multi-line input |
| | Display clear button when input has value |
| | Apply CSS classes for sizing/validation/appearance (e.g., |
| | Enable ( |
| | Allow selection but prevent editing |
| | Enable right-to-left rendering |
| | Persist value state between page reloads ⚠️ Stores data in browser storage — enable only with explicit user consent |
| | Control browser autocomplete ( |
| | Pass additional HTML attributes (e.g., |
| | Override global culture/localization value |
| | Set component width |
| | Render element before input |
| | Render element after input |
| Event | Arguments | Purpose |
|---|---|---|
| | Fires after component initialization |
| | Fires when component is destroyed |
| | Fires when value changes on focus-out |
| | Fires on every keystroke |
| | Fires when TextBox gains focus |
| | Fires when TextBox loses focus |
ℹ️ External links below are for manual reference only. Do not auto-fetch these URLs in an agentic pipeline without explicit user consent.