---
tags: [gradio-custom-component, TextBox, textbox]
title: gradio_tokenizertextbox
short_description: Textbox tokenizer
colorFrom: blue
colorTo: yellow
sdk: gradio
pinned: false
app_file: space.py
---
# `gradio_tokenizertextbox`
name | type | default | description |
---|---|---|---|
value |
```python typing.Union[str, dict, typing.Callable, NoneType][ str, dict, Callable, None ] ``` | None |
The initial value. Can be a string to initialize the text, or a dictionary for full state. If a function is provided, it will be called when the app loads to set the initial value. |
model |
```python str ``` | "Xenova/gpt-3" |
The name of a Hugging Face tokenizer to use (must be compatible with Transformers.js). Defaults to "Xenova/gpt-2". |
display_mode |
```python "text" | "token_ids" | "hidden" ``` | "text" |
Controls the content of the token visualization panel. Can be 'text' (default), 'token_ids', or 'hidden'. |
hide_input |
```python bool ``` | False |
If True, the component's own textbox is hidden, turning it into a read-only visualizer. Defaults to False. |
model_max_length |
```python int | None ``` | None |
The maximum number of tokens for the model. If the token count exceeds this, the counter will turn red. If not provided, the component will try to detect it from the loaded tokenizer. |
preview_tokens |
```python bool ``` | False |
If True, the component displays the formatted tokens. |
lines |
```python int ``` | 2 |
The minimum number of line rows for the textarea. |
max_lines |
```python int | None ``` | None |
The maximum number of line rows for the textarea. |
placeholder |
```python str | None ``` | None |
A placeholder hint to display in the textarea when it is empty. |
autofocus |
```python bool ``` | False |
If True, will focus on the textbox when the page loads. |
autoscroll |
```python bool ``` | True |
If True, will automatically scroll to the bottom of the textbox when the value changes. |
text_align |
```python typing.Optional[typing.Literal["left", "right"]][ "left" | "right", None ] ``` | None |
How to align the text in the textbox, can be: "left" or "right". |
rtl |
```python bool ``` | False |
If True, sets the direction of the text to right-to-left. |
show_copy_button |
```python bool ``` | False |
If True, a copy button will be shown. |
max_length |
```python int | None ``` | None |
The maximum number of characters allowed in the textbox. |
label |
```python str | None ``` | None |
The label for this component, displayed above the component. |
info |
```python str | None ``` | None |
Additional component description, displayed below the label. |
every |
```python float | None ``` | None |
If `value` is a callable, this sets a timer to run the function repeatedly. |
show_label |
```python bool ``` | True |
If False, the label is not displayed. |
container |
```python bool ``` | True |
If False, the component will not be wrapped in a container. |
scale |
```python int | None ``` | None |
The relative size of the component compared to others in a `gr.Row` or `gr.Column`. |
min_width |
```python int ``` | 160 |
The minimum-width of the component in pixels. |
interactive |
```python bool | None ``` | None |
If False, the user will not be able to edit the text. |
visible |
```python bool ``` | True |
If False, the component will be hidden. |
elem_id |
```python str | None ``` | None |
An optional string that is assigned as the id of this component in the HTML DOM. |
elem_classes |
```python list[str] | str | None ``` | None |
An optional list of strings that are assigned as the classes of this component in the HTML DOM. |