How to use label like input in react form?

0 Answers 91 Views
Form Input Labels 
n/a
Top achievements
Rank 1
Iron
Iron
n/a asked on 13 Oct 2022, 02:20 AM
Why does the telerik.com react site only have input controls in the form?
Input controls are not always in the input form. Your example is too narrow.
I want to put a label inside the input form. It is a control type with an initial value linked.

Can you edit the source from the link below?
thank you

 

https://stackblitz.com/edit/react-bbc32g?file=app%2Fmain.tsx

 

 

Wissam
Telerik team
commented on 14 Oct 2022, 09:30 AM

Hi, Won Bae Jung,

I have edited your example to include Label components inside the form fields:

https://stackblitz.com/edit/react-bbc32g-t1pbsk?file=app%2Fmain.tsx 

In the email field, the `InputWithLabel` custom component is passed to the component prop, which renders an Input and a Label. The initial value of the label is passed to the fieldRenderProps.

In the third field, only a Label is rendered, and the value passed is from the `initialValues`, like the example of the Input.

If you want to render a Label component directly to the component prop similar to the Input, the label value should be passed to the children prop.

<Field
  name={"field name"}
  component={Label}
  children={"label value"}
 />

The Form Field allows passing any component to its component property such as a Label, TextArea, or a custom-made component.

For more information about Labels inside the Form, please refer to this article:

https://www.telerik.com/kendo-react-ui/components/form/labels/ 

I hope this matches what you need, please let us know if you have any further questions.

Regards,
Wissam
Progress Telerik

n/a
Top achievements
Rank 1
Iron
Iron
commented on 21 Oct 2022, 05:29 AM

very nice! good! thank you!!!! 

No answers yet. Maybe you can help?

Tags
Form Input Labels 
Asked by
n/a
Top achievements
Rank 1
Iron
Iron
Share this question
or