Angular TextBox - Overview
The TextBox is a UI component that enables a user to enter and edit a single line of text.
The following code adds a simple TextBox with a placeholder to your page.
HTML
TypeScript
- <dx-text-box
- placeholder="Type a text here...">
- </dx-text-box>
- import { DxTextBoxModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxTextBoxModule
- ],
- // ...
- })
If an end user should not be able to edit the value in the TextBox, assign true to the readOnly property. In this case, make sure to set the value property too.
HTML
TypeScript
- <dx-text-box
- value="The text that should not be edited"
- [readOnly]="true">
- </dx-text-box>
- import { DxTextBoxModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxTextBoxModule
- ],
- // ...
- })