> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-rn-guide-message-privately.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# TextInput Element

> TextInput Element — CometChat documentation.

The `TextInputElement` class is used to create a text input element in a user interface.

### Constructor

| Name             | Type                 | Description                                   |
| ---------------- | -------------------- | --------------------------------------------- |
| **elementId**    | string               | Used to set unique Id for the element         |
| **label**        | string               | Used to set a label for the element           |
| **defaultValue** | String               | Used to set the default value for the element |
| **optional**     | bool                 | Used to set an optional flag for the element  |
| **placeholder**  | TextInputPlaceholder | Used to set placeholder for the element       |
| **maxLines**     | int                  | Used to set max lines for the element         |

***

### Usage

How to create an instance of the `TextInputElement` class:

```php theme={null}
TextInputElement( elementId: "name", label: "Enter name ", optional: false)
```

In the above example, a new instance of `TextInputElement` is created with the elementId "name" and the label "Enter name".

***

#### Default Value of the Input Element

The `defaultValue` prop sets the default value in the text input, For example:

<Tabs>
  <Tab title="Dart">
    ```dart theme={null}
    TextInputElement(
        elementId: "name",
        label: "Enter name ",
        optional: false,
        defaultValue: "shan"
    )
    ```
  </Tab>
</Tabs>
