Hi Elamathi,
yes Floating label textbox is possible in mendix with custom styling ,
done.
Hi,
I appreciate this question has been answered but if anyone is looking for a code snippet i have found the below works for me.
The CSS is as follows:
.input-container:has(input:focus) ~ .field-title-container,
.input-container:has(input:focus):valid ~ .field-title-container,
.input-container:has(input:not(:placeholder-shown)) ~ .field-title-container{
position: absolute;
left: 1.5rem;
top: 0.5rem;
max-width: calc(100% - 1rem);
height: 0.75rem;
line-height: .75rem;
font-size: 1rem;
pointer-events: none;
}
.input-container input{
letter-spacing: -.025rem;
width: 100%;
-webkit-appearance: none;
background-color: transparent;
outline: 0!important;
transition: margin .3s,padding-bottom .3s,color .3s;
}
.field-title-container{
position: absolute;
left: 1.5rem;
top: 1.5rem;
max-width: calc(100% - 1rem);
line-height: 1.5rem;
font-size: 16px;
transition: all .3s;
pointer-events: none;
z-index: 1;
}
.field-container{
position: relative;
display: flex;
flex-wrap: wrap;
margin-bottom: 0;
}
.floating-label {
width: 100%;
display: inline-block;
-webkit-user-select: none;
user-select: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
The css may require some changing to make it work exactly how you need but this should get you started. The building block can then be used wherever you want to use a textbox.