Basic usage
Constructor
str | Callable | None
default:"None"
Default text to display. If a function is provided, it will be called each time the app loads
Literal['text', 'password', 'email']
default:"'text'"
Input type:
"text"- Standard text input"password"- Masked password input"email"- Email input with validation
lines must be 1int
default:"1"
Minimum number of visible lines
int | None
default:"None"
Maximum number of visible lines. If None, defaults to
max(lines, 20) for text typestr | None
default:"None"
Placeholder hint text
str | None
default:"None"
Label displayed above the component
str | None
default:"None"
Additional info text below the label. Supports markdown/HTML
bool | None
default:"None"
Whether to display the label
bool | None
default:"None"
Whether the textbox is editable. Inferred automatically if not provided
bool | Literal['hidden']
default:"True"
Whether the component is visible
bool
default:"False"
Whether to focus on the textbox when the page loads
bool
default:"True"
Whether to automatically scroll to bottom when value changes
Literal['left', 'right'] | None
default:"None"
Text alignment. Only works with
type="text"bool
default:"False"
Whether to render text right-to-left. Only works with
type="text"int | None
default:"None"
Maximum character length (including newlines)
str | bool | None
default:"False"
True- Show submit button with iconstr- Show submit button with custom textFalse- Hide submit button
str | bool | None
default:"False"
True- Show stop button with iconstr- Show stop button with custom textFalse- Hide stop button
list[Literal['copy'] | Button] | None
default:"None"
List of buttons to show. Options:
"copy"- Copy text to clipboard- Custom
gr.Button()instances
Events
The Textbox component supports the following events:- change - Triggered when value changes
- input - Triggered on every keystroke
- select - Triggered when text is selected
- submit - Triggered when Enter is pressed
- focus - Triggered when component gains focus
- blur - Triggered when component loses focus
- stop - Triggered when stop button is clicked
- copy - Triggered when text is copied