JavaVaadin
(JavaVaadin Vaadinjava)
March 15, 2019, 6:42pm
1
Hi.
I have two textAreas. For 1st one i want to make labels align row center, for the 2nd column flew-start. I give for every of them own Id and created separate html files for each. But when 1st textarea changes the 2nd one changes like the 1st, i can’t give them their own label align.
How can i do it?
JavaVaadin
(JavaVaadin Vaadinjava)
March 18, 2019, 7:29am
2
JavaVaadin
(JavaVaadin Vaadinjava)
March 18, 2019, 5:29pm
3
JavaVaadin Vaadinjava:
Answer is here:
https://stackoverflow.com/questions/55195478/vaadin-13-textarea-html-styling?noredirect=1#comment97158055_55195478
Got another problem - flex-direction doesn’t work here. It works when we write like:
.vaadin-text-area-container {
flex-direction: column;
}
But it makes flex-direction: column for all textareas.
Any ideas how to make for each its own direction?
JavaVaadin
(JavaVaadin Vaadinjava)
March 21, 2019, 5:39pm
4
Anybody help with this problem, please.
Thanks!
ollit.1
(Olli Tietäväinen)
March 22, 2019, 8:08am
5
You need to apply a different class name for the containers where you want a different flex-direction
and create a new CSS rule for that.
JavaVaadin
(JavaVaadin Vaadinjava)
March 22, 2019, 8:50am
6
Hi, Olli. Thanks for reply.
I have different classname for each textareas. And could set them this style only with html as Tatu Lund replied.
But I can set flex direction only like that:
.vaadin-text-area-container{
flex-direction: row;
}
I don’t know how to change textarea’s “vaadin-text-area-container” name.
JavaVaadin
(JavaVaadin Vaadinjava)
March 22, 2019, 1:55pm
7
It would be great if you could send some code which shows what you say.
Thanks!
Tatu2
(Tatu Lund)
March 22, 2019, 4:43pm
8
You need to have in Java code
textArea1.addClassName("my-text-area1");
textArea2.addClassName("my-text-area2");
And styles.html
<dom-module theme-for="vaadin-text-area" id="style-for-text-area1">
<template>
<style>
:host(.my-text-area1) [part="label"]
{
... styles here ...
}
:host(.my-text-area2) [part="label"]
{
... styles here ...
}
</style>
</template>
</dom-module>
JavaVaadin
(JavaVaadin Vaadinjava)
March 23, 2019, 10:34am
9
Tatu Lund:
You need to have in Java code
textArea1.addClassName("my-text-area1");
textArea2.addClassName("my-text-area2");
And styles.html
<dom-module theme-for="vaadin-text-area" id="style-for-text-area1">
<template>
<style>
:host(.my-text-area1) [part="label"]
{
... styles here ...
}
:host(.my-text-area2) [part="label"]
{
... styles here ...
}
</style>
</template>
```
Thanks for your reply.
But flex-direction doesn’t work there
<dom-module theme-for="vaadin-text-area" id="style-for-text-area1">
<template>
<style>
:host(.my-text-area1) [part="label"]
{
flex-direction:row;
}
:host(.my-text-area2) [part=“label”]
{
flex-direction: column;
}
Tatu2
(Tatu Lund)
March 25, 2019, 8:27am
10
What you are trying to use the flex-direction for? There is no elements in label part that could be affected by direction change … so probably you want to apply the direction to different part.
If you aim to have the label on the left side of the value, then you need to do something like
<dom-module theme-for="vaadin-text-area" id="style-for-text-area">
<template>
<style>
:host(.my-text-area) [part="label"]
{
padding-right: 5px;
}
:host(.my-text-area) .vaadin-text-field-container {
flex-direction: row;
}
</style>
</template>
</dom-module>
The above styles may also alter how the width and height of the component needs to be set to achieve the best looks.
Note also the added padding for the label.