Skip to content

Commit acec4ff

Browse files
committed
Add documention on usage of custom title fields.
1 parent ce852e6 commit acec4ff

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,25 @@ render((
231231
232232
If you're curious how this could ever be useful, have a look at the [Kinto formbuilder](https://github.com/Kinto/formbuilder) repository to see how it's used to provide editing capabilities to any form field.
233233

234+
## Custom titles
235+
236+
You can provide your own implementation of the `TitleField` base React component for rendering any title. This is useful when you want to augment how titles are handled.
237+
238+
239+
To proceed so, you can pass a `TitleField` prop to the `Form` component instance:
240+
241+
```jsx
242+
243+
const CustomTitleField = ({title}) => <div id="custom">{title}</div>;
244+
245+
render((
246+
<Form schema={schema}
247+
uiSchema={uiSchema}
248+
formData={formData}
249+
TitleField={CustomTitleField} />
250+
), document.getElementById("app"));
251+
```
252+
234253
## Custom buttons
235254

236255
You can provide custom buttons to your form via the `Form` component's `children`. A default submit button will be rendered if you don't provide children to the `Form` component.

0 commit comments

Comments
 (0)