2.1.0 • Published 6 months ago
@makeform/choice v2.1.0
@makeform/choice
Dropdown style widget for users to make one single choice between multiple options.
Configs
values: Array of string for options in this widget.multiple: default false. when set to true, allow multiple choicesother: an object with following fields, for configuration of custom data:enabled: show a dedicatedotheroption.editable: show a text field whenotheris chosenrequireOnCheck: default false. when set to true, text field forothermust not empty ifotheris chosen.
sep: default,. text separator for joining values from multiple choice in view mode.layout: eitherroworcolumn. defaultcolumn. decide how to layout text field forotherand select widget.
Extension
use init.choice event with {config: { ... }} parameter to create a new widget based on certain configuration. For example:
module.exports =
pkg: extend: name: "@makeform/choice"
init: ({pubsub}) -> pubsub.fire \init.choice, config: values: <[Apple Orange Banana]>Specified configurations won't be overrided by users so always predefine a config if you don't want user to change its value.
License
MIT