# How to dynamically disable EuiButton in Elastic UI

**URL:** https://discuss.elastic.co/t/how-to-dynamically-disable-euibutton-in-elastic-ui/229737
**Category:** Kibana
**Created:** [April 25, 2020, 2:31am UTC](https://discuss.elastic.co/t/how-to-dynamically-disable-euibutton-in-elastic-ui/229737 "2020-04-25T02:31:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)
#### Post date: [April 25, 2020, 2:31am UTC](https://discuss.elastic.co/t/how-to-dynamically-disable-euibutton-in-elastic-ui/229737/1 "2020-04-25T02:31:25Z")

</div>

I'm new to Elastic UI and React. Can you tell me how to dynamically disable a EuiButton? I know for a regular React button you can do it by passing the state of the button like the following:

`<button disabled={!this.state.buttonDisabled} onClick={this.doSomething}>`

However, I can't seem to find a way to pass the state for the EuiButton. You have to pass in the "isDisabled" option when building the button like this

`<EuiButton size="xs" isDisabled Button Text </EuiButton>`

How do i dynamically pass in the "isDisabled" option like I would for a regular React button?

---

<div class="post-metadata">

### Author: ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)
#### Post date: [April 25, 2020, 9:11am UTC](https://discuss.elastic.co/t/how-to-dynamically-disable-euibutton-in-elastic-ui/229737/2 "2020-04-25T09:11:47Z")

</div>

It works the same way there, the property is just called `isDisabled` instead of `disabled`:

```auto
<EuiButton size="xs" isDisabled={!this.state.buttonDisabled} onClick={this.doSomething}>
  Button Text
</EuiButton>

```

---

<div class="post-metadata">

### Author: ![ssimmons](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@ssimmons](https://discuss.elastic.co/u/ssimmons)
#### Post date: [April 25, 2020, 3:18pm UTC](https://discuss.elastic.co/t/how-to-dynamically-disable-euibutton-in-elastic-ui/229737/3 "2020-04-25T15:18:18Z")

</div>

> [@flash1293](#):
>
> isDisabled={!this.state.buttonDisabled}

Thank you! I could have sworn I tried it that way but evidently I didn't. It's working now. Thanks!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 23, 2020, 3:18pm UTC](https://discuss.elastic.co/t/how-to-dynamically-disable-euibutton-in-elastic-ui/229737/4 "2020-05-23T15:18:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
