Skip to content

A popover confirm dialog for react, Popover component from react-bootstrap.

License

Notifications You must be signed in to change notification settings

Chyrain/react-popconfirm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-popconfirm

version downloads MIT License

A popover confirm dialog for react, react-bootstrap and react-confirm are used with.

PopConfirm

Usage

// import first
import PopConfirm from 'react-popconfirm'


// call it!
/**
 * options: 
 *  {
 *    element,              // require
 *    confirmation,         // require
 *    placement = 'top',    // require
 *    okLabbel = 'Yes',     // optional (default 'Yes')
 *    cancelLabel = 'No',   // optional (default 'No')
 *    positionLeft,         // optional (auto calculate by element position and width,height)
 *    positionTop,          // optional (auto calculate by element position and width,height)
 *    width = 160,          // optional (default 160)
 *    height = 70           // optional (default 70)
 *    confirmationColor = '#e83f3f',  // optional (default '#e83f3f')
 *    okStyle = 'info',               // optional (default 'info', available: default|primary|success|info|warning|danger|link)
 *    cancelStyle = 'default'         // optional (default 'default', available: default|primary|success|info|warning|danger|link)
 *  }
 */
PopConfirm({
	confirmation:'Are you sure?',
	okLabbel: 'Yes',
	cancelLabel: 'No',
	placement:'top',
	element:target	// target is the element you clicked
  }).then(
  (result) => {
    // `proceed` callback
    console.log('proceed called');
  },
  (result) => {
    // `cancel` callback
    console.log('cancel called');
  }
)
// nothing will be called when `dismiss` is triggered.

Try example

# run example, auto open browser and enable hot loader
cd example
npm install
npm start

# build
npm run build

License

MIT

About

A popover confirm dialog for react, Popover component from react-bootstrap.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published