MaxPower
MaxPower

Reputation: 161

Semantic-ui react modal shorthand prevent button closing modal

Using the code on the docs page shown below for a shorthand modal, how do i stop the button from closing the modal in the actions property? Ive tried preventDefault, no luck, its got me stumped?

import React from 'react'
import { Button, Modal } from 'semantic-ui-react'

const ModalExampleShorthand = () => (
  <Modal
    trigger={<Button>Show Modal</Button>}
    header='Reminder!'
    content='Call Benjamin regarding the reports.'
    actions={['Snooze', { key: 'done', content: 'Done', positive: true }]}
  />
)

export default ModalExampleShorthand

Upvotes: 1

Views: 589

Answers (1)

MaxPower
MaxPower

Reputation: 161

Cant believe I didnt think of this, I just needed to add onClick handler in the actions, ie:

actions={['Snooze', { key: 'done', content: 'Done', positive: true, onClick: myFunc }]}

Upvotes: 1

Related Questions