- index
- quickstart designers
- tutorials designers
- quickstart developers
- tutorials developers
- elements
- mixins
- AddHasValueAttributeMixin.js
- DraggableElementMixin.js
- DraggableListMixin.js
- FormElementMixin.js
- InputMixin.js
- LabelsMixin.js
- NativeReflectorMixin.js
- NativeValidatorMixin.js
- StyleableMixin.js
- SyntheticValidatorMixin.js
- ThemeableMixin.js
- appendices
- material theme
This mixin adds the capability to use common tags. Our goal is to reduce friction for anyone not used to custom elements, shadow DOM and prefers to create and style their projects using plain HTML markup.
Usage is simple. Any TPE elements accepts plain CSS code added as , nested in the elements markup, like so:
<nn-input-text>
<style slot="style">
#native {
color: blue;
}
</style>
</nn-input-text>
That allows developers to pierce the shadow DOM and override all of the elements styles using familiar syntax.
export const StyleableMixin = (base) => {
return class Base extends base {
static get styles () {
return []
}
firstUpdated () {
super.firstUpdated()Add the equivalent of
const styleSlot = document.createElement('slot')
styleSlot.setAttribute('name', 'style')
styleSlot.setAttribute('id', 'style-slot')
this.shadowRoot.appendChild(styleSlot)If an element has one or more style.
So, any