2

I am using https://react.semantic-ui.com/modules/modal/ this modal. I would like to add an id attribute in div which have modal class. How can I do that ?

enter image description here

abu abu
  • 6,599
  • 19
  • 74
  • 131

1 Answers1

2

Did you try simply adding an id prop?:

<Modal
  trigger={<Button onClick={this.handleOpen}>Show Modal</Button>}
  open={this.state.modalOpen}
  onClose={this.handleClose}
  basic
  size='small'
  id="theIdHere"
>
...

it worked for me

<div class="ui page modals dimmer transition visible active" style="display: flex !important;">
  <div id="theIdHere" class="ui small basic modal transition visible active">
  ...

However, the modal div is only available once the modal is shown, so be careful to attach the event upon modal open and remove once the modal is closed

Tyro Hunter
  • 755
  • 1
  • 8
  • 20