Created
June 5, 2018 14:47
-
-
Save travist/a701ac5ebf3f6fe72f568e82db684493 to your computer and use it in GitHub Desktop.
Override a Form.io component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This shows how to override a Form.io component by extending it and creating your own methods. | |
import SelectComponent from 'formiojs/components/select/Select'; | |
import Components from 'formiojs/components/Components'; | |
export default class CustomSelect extends SelectComponent { | |
constructor(component, options, data) { | |
// Force all selects to use the html5 widget. | |
component.widget = 'html5'; | |
super(component, options, data); | |
} | |
} | |
// Override the 'select' component to use our custom class instead. | |
Components.setComponent('select', CustomSelect); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment