formbuilder
formbuilder copied to clipboard
Add a way to add paragraph of text
Sometimes, it can be useful to have a paragraph of text in addition to the different inputs.
I would love to have @n1k0 input on this one. It seems to me that JSON Schema doesn't support custom paragraph of text, especially because that's not defining an input.
Where would you put such information?
especially because that's not defining an input.
JSON Schema doesn't define inputs but data structures, and a string is a perfectly valid one. So we need to find a way to identify string fields dedicated to representing paragraphs of text in the schemas consumed by the formbuilder.
We could establish a kind of convention, eg. if any object field name is prefixed with some identified pattern, we know we have to use it as a static paragraph of text; and the good news is that schemas can have a description attribute which seems like a good place to store the actual text of that paragraph.
Now our custom SchemaField obviously needs to intercept object fields named that way to simply render a paragraph of text instead of a standard StringField.
Does that make sense?
That makes a lot of sense, yes! Thanks :)
I would go for @n1k0 solution using the placeholder value of the StringField to store the value of the Paragraph.
Related to https://github.com/mozilla-services/react-jsonschema-form/pull/213
After thinking more about this, and after a conversation with @n1k0 it seems that Widgets already offer a way to include some text, for instance a hint just after the display of the input.
Rather than adding a specific "paragraph" widget, it would make sense to allow editing this "hint" location from inside the formbuilder.
Yes the ui:help thing?