pwix:bootbox
What is it ?
A thin package for Meteor which encapsulates the creation and the display of modal dialogs:
-
either as an
alertdialog, which just display a message and waits for an aknowledgement of the user, -
or a
confirmdialog, which waits for a Yes|No decision of the user.
Thanks to the pwix:modal package, the dialogs are draggable, and can be moved by the user.
Usage
1 import { Bootbox } from 'meteor/pwix:bootbox'; 2 3 alert() 4 5 Bootbox.alert( message ); 6 7 no title 8 btn: OK 9 10 or 11 12 Bootbox.alert({ 13 title: title, 14 message: message, 15 btn: text, 16 cb: cb 17 }); 18 19 confirm() 20 21 Bootbox.confirm( message, ( res ) => { 22 res = true|false 23 }); 24 25 no title 26 btns: 27 Cancel -> false 28 OK -> true 29 30 or 31 32 Bootbox.confirm({ 33 title: title, 34 message: message, 35 btn_true: text, 36 btn_false: text 37 }, ( res ) => { 38 res = true|false 39 }); 40 41 or 42 43 Bootbox.confirm({ 44 title: title, 45 message: message, 46 btns_family: Bootbox.C.Family.YESNO | Bootbox.C.Family.OKCANCEL | Bootbox.C.Family.OKCLOSE 47 }, ( res ) => { 48 res = true|false 49 });
Note that provided arguments are directly passed to Modal.run() method. You may so configure the opened modal as you want. See the pwix:modal documentation.
What does it provide ?
Bootbox
A globally exported object with following properties:
Methods
Bootbox.alert()
Bootbox.configure()
See below.
Bootbox.confirm()
Configuration
The package's behavior can be configured through a call to the Bootbox.configure() method, with just a single javascript object argument, which itself should only contains the options you want override.
Known configuration options are:
-
positionThe default positionning of the dialog boxes.
See
pwix:modalfor the possible values.Defaults to
Modal.C.Position.AUTO. -
verbosityDefine the expected verbosity level.
The accepted value can be any or-ed combination of following:
-
Forms.C.Verbose.NONEDo not display any trace log to the console
-
Forms.C.Verbose.CONFIGURETrace
Forms.configure()calls and their resultthis is the default value.
-
Please note that Bootbox.configure() method should be called in the same terms both in client and server sides.
Remind too that Meteor packages are instanciated at application level. They are so only configurable once, or, in other words, only one instance has to be or can be configured. Addtionnal calls to Bootbox.configure() will just override the previous one. You have been warned: only the application should configure a package.
Bootbox.configure() is a reactive data source.
NPM peer dependencies
Starting with v 1.1.0, and in accordance with advices from the Meteor Guide, we no more hardcode NPM dependencies in the Npm.depends clause of the package.js.
Instead we check npm versions of installed packages at runtime, on server startup, in development environment.
Dependencies as of v 1.6.0:
1 'lodash': '^4.17.21'
Each of these dependencies should be installed at application level:
meteor npm install <package> --save
Translations
New and updated translations are willingly accepted, and more than welcome. Just be kind enough to submit a PR on the Github repository.
P. Wieser
- Last updated on 2026, Apr. 2nd