A text box also called an input box, text field or text entry box, is a control element of a
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
, that should enable the user to input text information to be used by a program.
Human Interface Guidelines
Human interface guidelines (HIG) are software development documents which offer application developers a set of recommendations. Their aim is to improve the experience for the users by making application interfaces more intuitive, learnable, and ...
recommend a single-line text box when only one line of input is required, and a multi-line text box only if more than one line of input may be required. Non-editable text boxes can serve the purpose of simply displaying text.
A typical text box is a rectangle of any size, possibly with a border that separates the text box from the rest of the interface. Text boxes may contain zero, one, or two
scrollbar
A scrollbar is an interaction technique or widget (GUI), widget in which continuous text, pictures, or any other content can be Scrolling, scrolled in a predetermined direction (up, down, left, or right) on a computer display, window (computing) ...
s. Text boxes usually display a
text cursor
In human–computer interaction, a cursor is an indicator used to show the current position on a computer monitor or other display device that will respond to input, such as a text cursor or a mouse pointer.
Etymology
''Cursor'' is Latin for ...
(commonly a blinking vertical line), indicating the current region of text being edited. It is common for the
mouse
A mouse (: mice) is a small rodent. Characteristically, mice are known to have a pointed snout, small rounded ears, a body-length scaly tail, and a high breeding rate. The best known mouse species is the common house mouse (''Mus musculus'' ...
cursor to change its shape when it hovers over a text box.
Standard functionality
Typical implementations allow a user to do the following. (The keys indicated relate to the text box widgets in Microsoft Windows and Mac OS X; similar if not identical keyboard bindings exist under the
X Window System
The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems.
X originated as part of Project Athena at Massachusetts Institute of Technology (MIT) in 1984. The X protocol has been at ...
and other systems, and typically follow the same scheme as Windows.)
Enter text
When keys are pressed on a keyboard, the text appears where the caret is. Some very simple text boxes may not show a caret, which would suggest that new characters typed in will appear at the end of the current text.
Navigate and manipulate text
Using a mouse:
* Change the caret position by clicking the desired point with a mouse cursor;
* Select a portion of text by pressing the main mouse button while pointing the cursor at one end of the desired part of the text and dragging the cursor to the other end while holding the button pressed.
Using the keyboard:
* Pressing
arrow keys
Arrow keys or cursor movement keys are keys on a computer keyboard that are either programmed or designated to move the cursor (computers), cursor in a specified direction.
The term "cursor movement key" is distinct from "arrow key" in that th ...
changes caret position by one character or line (in multiline text boxes);
* Pressing / keys (
Microsoft's Windows OS) or -left arrow / Command-right arrow (
Apple
An apple is a round, edible fruit produced by an apple tree (''Malus'' spp.). Fruit trees of the orchard or domestic apple (''Malus domestica''), the most widely grown in the genus, are agriculture, cultivated worldwide. The tree originated ...
's
Mac OS
Mac operating systems were developed by Apple Inc. in a succession of two major series.
In 1984, Apple debuted the operating system that is now known as the classic Mac OS with its release of the original Macintosh System Software. The system ...
) moves the caret to the beginning / end of the line;
* Pressing / moves the caret a page (the number of lines that can be displayed in the text box at a time) backward / forward (Windows) or moves the
scrollbar
A scrollbar is an interaction technique or widget (GUI), widget in which continuous text, pictures, or any other content can be Scrolling, scrolled in a predetermined direction (up, down, left, or right) on a computer display, window (computing) ...
thumb a page backward / forward without changing the caret position (Mac OS);
* Holding the key (Windows) while pressing arrow keys or / keys makes the caret move at larger steps, e.g. words, paragraphs or beginning / end of document;
* Holding the (Mac OS) while pressing arrows moves the caret whole words or paragraphs;
* Holding the while pressing up or down arrows (Mac OS) or Holding the key while pressing / (Windows) moves the caret to the beginning or end of the document;
* Holding the while changing the caret position with a mouse or keyboard selects the text between the caret position from when shift was first pressed and its current position.
* Pressing (Windows) selects all text.
Edit text
Work in insert or overwrite mode, typically switched using . In insert mode if there is a character to the right of the caret, the new character will be inserted before it, while in overwrite mode typing a new character will replace (overwrite) the character to the right of the caret position.
Typing in a text while some part of the text already entered is selected will replace the selected text.
/ keys remove one character right / left of current caret position, while pressing them together with the or removes one word.
Edit the text using standard
clipboard
A clipboard is a thin, rigid writing board with a clip at the top for holding paper in place. A clipboard is typically used to support paper with one hand while writing on it with the other, especially when other writing surfaces are not avail ...
operations.
Edits can be
undo
Undo is an interaction technique which is implemented in many computer programs. It erases the last change done to the document, reverting it to an older state. In some more advanced programs, such as graphic processing, undo will negate the las ...
ne and
redo
Undo is an interaction technique which is implemented in many computer programs. It erases the last change done to the document, reverting it to an older state. In some more advanced programs, such as Graphics software, graphic processing, undo w ...
ne with
/
(Windows) or / (Mac OS)
References and notes
{{Graphical control elements
Graphical control elements