flipbyte / formik-json-schema

Easily create react forms using JSON / Javascript Object
MIT License
152 stars 40 forks source link

[feat] Placeholder text functionality #90

Closed gitdubz closed 2 years ago

gitdubz commented 2 years ago

Is your feature request related to a problem? Please describe.

Currently, default functionality does not support having a placeholder text for input/text elements. It would be useful to be able to provide a placeholder text

Describe the solution you'd like

From the example schema, something added like this would be great.

name: { name: 'name', placeholder: 'Full name', <-------- Add a placeholder property and apply it to the fields if supplied and relevant label: 'Name', type: 'field', renderer: 'text', fieldType: 'text', validation: [['string'], ['required'], ['min', 3]], },

Describe alternatives you've considered

Using the "comment" property, which is sometimes used as helper text for the user.

easeq commented 2 years ago

You should be to add the placeholder property using the attributes object as shown below:

name: {
   ...
   attributes: {
       ...,
       placeholder: "Fulle name",
   }
}
gitdubz commented 2 years ago

Perfect thanks!