# setComponentAttr

## Description

Allows users to set a value to an attribute of a component.

## Input / Parameter

| Name        | Description                     | Input Type  | Default | Options | Required                           |
| ----------- | ------------------------------- | ----------- | ------- | ------- | ---------------------------------- |
| component   | The name of the component.      | String/Text | -       | -       | Partial (Yes if no 'componentId'.) |
| componentId | The id of the component.        | String/Text | -       | -       | Partial (Yes if no 'component'.)   |
| attr        | The attribute of the component. | String/Text | -       | -       | Yes                                |
| value       | The value of the attribute.     | String/Text | -       | -       | Yes                                |

**\* Note:** Either component or componentId must have value in order for this function to work.

## Output

N/A

Note: The component will be updated to show the value assigned to the attribute.

## Callback

N/A

## Video

Coming Soon.

## Example

The user override a specific atrribute of a component.

### Step

1. Draw an edit text "txtTest", a button "setComponentAttr"

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-32be22a23d5457a698ccfd38825cdffd0597d00a%2FsetComponentAttr-step-1.png?alt=media)
2. Call the function

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-4354a384c870ff4b05573baa65168d4adad45c6a%2FsetComponentAttr-step-2.png?alt=media)

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-25bcda17774f790a48b90bd9c4f2a342dc4729ec%2FsetComponentAttr-step-3.png?alt=media)

### Result

The attribute "value" of the edit text "txtTest" will have the value of "abc".

![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-8c2b824abed66e7cb2cb81bbb276e4282703b0c9%2FsetComponentAttr-result-1.png?alt=media)

## Links
