A react decorator for clickable items to confirm user intent.
npm install react-decision
A react decorator for clickable items to confirm user intent.
------
npm install react-decision
Use to wrap an item that has an onClick prop. When clicked, the user will be presented with a modal to confirm their intentions before continuing the onClick or aborting.
------
Can either be used standalone (uses ), or wrap a component that has an onClick property.
Standalone example
``javascript`
Wrapping
`javascript`
With props
`javascript`
message="Are you sure though?"
positiveLabel="Yep"
negativeLabel="Nope"
>
+ header: String, header text in modalString
+ message: , message text in modalString
+ positiveLabel: , label for the positive/continue button.String
+ negativeLabel: , label for the negative/cancel/abort button.Boolean
+ useFlex: , defaults to true, uses flexbox to centre the modal. Otherwise repositions vertically based on dynamic height.
If using standalone, you can also use:
+ onClick: function, called when the blocking modal receives positive confirmation.String`, classnames passed through to the generated button.
+ className: