<rjsf-if> Example

The if statement evaluates a property of the model and hides or displays an element based on that

<div id="app"> <rjsf-if data-model="showThing"> <p>thing to be shown</p> </rjsf-if> <button onclick="toggleShowThing">Toggle</button> </div>
import {rjsf} from '../rjsf.js' (function() { const appElement = document.getElementById('app'); const app = new rjsf(appElement); const viewmodel = { functions: { toggleShowThing: function(e) { e.preventDefault(); this.data.showThing = !this.data.showThing; } }, data: { showThing: true, } }; app.init(viewmodel); })();

thing to be shown

Back to example index