Shravan Dhar
Shravan Dhar

Reputation: 1560

Semantic ui react Popup getting closed on click

I'm using semantic-ui-react's Popup element. Following is the my component's behaviour:

Hover -> Shows text 1 (saved as a state variable)
Click -> Closes the hover text (attached an onClick which changes the value of state variable from text 1 to text 2

Now apparently, on click the popup closes so I'm not able to see the hovered text 2.

Is there a way, to keep the popup text from closing. I've tried e.stopPropogation() in the onClick but it didn't work.

Upvotes: 1

Views: 1074

Answers (1)

Shivaraj
Shivaraj

Reputation: 400

The popup has a props called open that takes the boolean. This will help you,

<Popup
  content="Hello"
  open={true}
  trigger={<Button content="A trigger" />}
/>

you can pass the value to it by managing via state. Here is the working example: Sandbox

Upvotes: 1

Related Questions