# Custom Input Component

When using custom input components, they must be passed in as props, like so:

```jsx
<EasyEdit    
    type="text"
    onSave={() => {}}
    editComponent={<CustomInput />}    
    displayComponent={<CustomDisplay />}
/>
```

When defining a custom input component, the function `setParentValue` is injected into your custom component, which must be called in order to pass the desired value up to the parent `EasyEdit` component.

For example, if your component was a text field that needed to set the `EasyEdit` value as a user id based on a username entered, you would need to pass the id to `this.props.setParentValue` in order to get that value to the `EasyEdit` component.

e.g.

```jsx
// Inside your custom 
input​onChange(searchTerm) {
    getUserIdByUsername(searchTerm).then((userId) => {
    this.props.setParentValue(userId);
})}
```

[<br>](https://giorgosart.gitbook.io/react-easy-edit/props)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://giorgosart.gitbook.io/react-easy-edit/examples/custom-input-component.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
