TextInput
Collects a string, optionally framed by prefix and postfix adornments.
It is the fallback for every string field without a more specific format, and also backs the
email, url and password formats through the type prop.
Example
<TextInput source="sku" prefix="#" />
<TextInput source="description" multiline />
<TextInput source="contact_email" type="email" />
Props
On top of these the component accepts the shared input props and
React Admin's TextInput props.
| Name | Type | Default | Description |
|---|---|---|---|
source (required) | string | — | Name of the field in the form record |
multiline | boolean | false | Renders a growing textarea instead of a single line |
type | string | 'text' | HTML input type — 'email', 'url', 'password' are set by the dispatcher |
disabled | boolean | false | Disables the input |
readOnly | boolean | false | Renders the value without allowing edits |
prefix | string | — | Adornment before the value |
postfix | string | — | Adornment after the value |
Schema mapping
Any string field without a recognised format; format: "text" turns multiline on, and
email / url / password set the HTML input type.
{"name": "description", "type": "string", "format": "text", "helpText": "Shown on the product page"}
- Python
- Ruby
from habarico.serializers import AdminModelSerializer, TextField
class ProductSerializer(AdminModelSerializer):
description = TextField(required=False)
class Meta:
model = Product
fields = ["id", "name", "description"]
See also
- TextField — the display counterpart
- SchemaPredictiveTextInput — the same input with AI suggestions