guillotinaweb / ngx-schema-form

HTML form generation based on JSON Schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Render HTML from schema property description

Jelledb opened this issue Β· comments

Hey πŸ‘‹

We're using ngx-schema-form to enable our customers to build their own forms, and it's working great so far.

One idea that we had, which would be awesome, is to enable custom HTML insertion via the JSON Schema description. This way you could do custom styling, provide hyperlinks, etc.

Our case would be to create JSON schema properties that contains links to support boards, e.g.

"paymentId": {
  "type": "string",
  "title": "Payment ID",
  "description": "Enter a valid payment ID. If you're not sure what to enter, please go to our <a href=\"https://docs.acmecorp.com/payment-id-help\">support page</a>"
}

Hint: it should be quite easy to do with Angular's [innerHtml] directive, which also makes sure there's no XSS magic going on.

Consider creating a custom UI Widget Library.
ngx-schema-form has support to use a complete customized UI Widget Library.
Here is an example using the Angular Material components:
DEMO: https://ngx-schema-form-material.web.app/
Try it yourself at Stackblitz: https://stackblitz.com/edit/angular-9-ngx-schema-form-material-template-9