IronFormElementBehavior
adds a name
, value
and required
properties to
a custom element. This element is deprecated, and only exists for back compatibility
with Polymer 1.x (where iron-form
was a type extension), and
it is not something you want to use. No contributions or fixes will be accepted.
See: Documentation.
npm install --save @polymer/iron-form-element-behavior
import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {IronFormElementBehavior} from '@polymer/iron-form-element-behavior/iron-form-element-behavior.js';
class SampleElement extends mixinBehaviors([IronFormElementBehavior], PolymerElement) {
static get template() {
return html`
<style>
:host {
display: block;
}
</style>
<input name="[[name]]" value="{{value}}">
`;
}
}
customElements.define('sample-element', SampleElement);