My question is related to this post in the "old" Vaadin Forum. I want to set the initial row number of the Vaadin TextArea to 1, so it looks like a TextField.
The mentioned post has the solution:
This requires a bit of JavaScript to fix. You need to set rows=1 to the internal element
<textarea part="value"></textarea>
Unfortunately I do not know how to apply this solution, as I am still a JS and CSS beginner. We already have some JS-code adjusting TextAreas (and other components), maybe at this part I need to add some code?
const $_documentContainer = document.createElement('template');
$_documentContainer.innerHTML = `<dom-module id="our-project-text-area" theme-for="vaadin-text-area">
<template>
<style> {
:host [part="input-field"] {
font-weight: lighter;
}
:host [part="input-field"]::after {
background-color: var(--mainColor);
}
:host([focused]:not([invalid])) [part="label"] {
color: var(--mainColor);
}
}
</style>
</template>
</dom-module>`;
document.head.appendChild($_documentContainer.content);
Can you please help me how to add attributes to a specific element inside the TextAreas Shadow DOM?