sweetalert2-react icon indicating copy to clipboard operation
sweetalert2-react copied to clipboard

React children

Open hipstersmoothie opened this issue 7 years ago • 3 comments

closes #9

enables:

<SweetAlert
  show={this.state.show}
  title="Demo"
  onConfirm={() => this.setState({ show: false })}
>
  SweetAlert in React
</SweetAlert>

or with react content enabled:

<SwalWithReactContent
  show={this.state.modal2}
> 
  <div>
    <h1>I am title</h1>
    <h2>I am subtitle</h2>
    <p>
      whatever elements you want
    </p>
  </div>
</SwalWithReactContent>

the surrounding div is necessary currently and i think it would require changes to sweetalert-react-content to remove. @zenflow

hipstersmoothie avatar Mar 09 '18 03:03 hipstersmoothie

btw @alex-shamshurin the test seem to be failing on master as well

hipstersmoothie avatar Mar 09 '18 03:03 hipstersmoothie

@alex-shamshurin I also think that we should just use sweetalert-react-content as part of the default swal instance. I feel like most users would want to be able to render react content as the default rather than having to go through a bunch of setup

hipstersmoothie avatar Mar 09 '18 03:03 hipstersmoothie

How do you feel about making the title or the html required?

hipstersmoothie avatar Mar 09 '18 03:03 hipstersmoothie