kendo-react
kendo-react copied to clipboard
feat: control the floating labels position of form components
The feature has been requested by a client in a support ticket. (ticket id: 1422821)
This is needed to avoid having to define the labels by yourself and apply the same className
s as our components.
We accept proposals for the property's name, i'm currently thinking of labelFloat
which will be of type boolean. Since there's no reason to want the label to stay in the input, the only valid scenario is for it to stay on the top, thus setting the labelFloat
to false
will disable its floating behavior and always keep it on top.
Should be included in the forms spec: https://github.com/telerik/k2/issues/139
Until a built-in feature is added, there is an easy solution for making the floating labels be static by adding a className to the FormElement and removing the offset of the floating labels: https://stackblitz.com/edit/react-fdtufq?file=app%2Fmain.jsx,index.html
<FormElement
className={'unfloat-labels'}
<style>
.unfloat-labels .k-floating-label-container.k-empty > .k-label{
top: 0px;
left: 0px;
pointer-events: all;
}