Skip to content

Latest commit

 

History

History
64 lines (56 loc) · 1.51 KB

rating-component-example.md

File metadata and controls

64 lines (56 loc) · 1.51 KB
description
Please read on custom components - before reading this article.

Rating Component Example

{% hint style="danger" %} Please Read on how to install custom components - before reading this article. {% endhint %}

{% hint style="success" %} Rating Component Example
Detailed Example can be seen here :

Custom Rating Component

{% code title="schema.json" %}

{
  "title": "Example for rendering custom rating example",
  "description": "A simple form for rendering custom rating example",
  "type": "object",
  "properties": {
    "customRating": {
      "type": "integer",
      "title": "Custom Rating Component",
      "component": "customRating"
    },
  }
}

{% endcode %}

{% code title="Example.jsx" %}

<Form
  schema={schema}
  uiSchema={uiSchema}
  formData={formData}
  onCancel={onCancel}
  onSubmit={onSubmit}
  onUpload={onUpload}
  onChange={onFormChanged}
  components={{
    customRating: ({ onChange }) => (
  		<CustomRating onChange={onChange} formData={formData} />
    ),
  }}
  submitOnEnter
  activityIndicatorEnabled
/>

{% endcode %}

{% code title="formData.json" %}

{
  "customRating": 5,
}

{% endcode %}