Skip to content

Commit 4fc99d1

Browse files
author
LFRW2K\lecmil2
committed
[MISC] Updated documentation
1 parent fea0336 commit 4fc99d1

File tree

1 file changed

+49
-5
lines changed

1 file changed

+49
-5
lines changed

packages/docs/docs/advanced-customization/custom-templates.md

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,27 @@ render(
7676
);
7777
```
7878

79-
You also can provide your own field template to a uiSchema by specifying a `ui:ArrayFieldTemplate` property with your Component or a string value from the `Registry`.
79+
You also can provide your own field template to a uiSchema by specifying a `ui:ArrayFieldTemplate` property with your Component :
8080

8181
```tsx
8282
import { UiSchema } from '@rjsf/utils';
83+
import ArrayFieldTemplate from './ArrayFieldTemplate';
8384

8485
const uiSchema: UiSchema = {
8586
'ui:ArrayFieldTemplate': ArrayFieldTemplate,
8687
};
8788
```
8889

90+
or a string value from the `Registry` :
91+
92+
```tsx
93+
import { UiSchema } from '@rjsf/utils';
94+
95+
const uiSchema: UiSchema = {
96+
'ui:ArrayFieldTemplate': 'CustomArrayFieldTemplate',
97+
};
98+
```
99+
89100
Please see the [customArray.tsx sample](https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/playground/src/samples/customArray.tsx) from the [playground](https://rjsf-team.github.io/react-jsonschema-form/) for another example.
90101

91102
The following props are passed to each `ArrayFieldTemplate`:
@@ -163,16 +174,27 @@ render(
163174
);
164175
```
165176

166-
You also can provide your own template to a uiSchema by specifying a `ui:ArrayFieldDescriptionTemplate` property with your Component or a string value from the `Registry`.
177+
You also can provide your own field template to a uiSchema by specifying a `ui:ArrayFieldDescriptionTemplate` property with your Component :
167178

168179
```tsx
169180
import { UiSchema } from '@rjsf/utils';
181+
import ArrayFieldDescriptionTemplate from './ArrayFieldDescriptionTemplate';
170182

171183
const uiSchema: UiSchema = {
172184
'ui:ArrayFieldDescriptionTemplate': ArrayFieldDescriptionTemplate,
173185
};
174186
```
175187

188+
or a string value from the `Registry` :
189+
190+
```tsx
191+
import { UiSchema } from '@rjsf/utils';
192+
193+
const uiSchema: UiSchema = {
194+
'ui:ArrayFieldDescriptionTemplate': 'CustomArrayFieldDescriptionTemplate',
195+
};
196+
```
197+
176198
The following props are passed to each `ArrayFieldDescriptionTemplate`:
177199

178200
- `description`: The description of the array field being rendered.
@@ -615,13 +637,24 @@ render(
615637
);
616638
```
617639

618-
You also can provide your own field template to a uiSchema by specifying a `ui:FieldTemplate` property with your Component or a string value from the `Registry`.
640+
You also can provide your own field template to a uiSchema by specifying a `ui:FieldTemplate` property with your Component :
619641

620642
```tsx
621643
import { UiSchema } from '@rjsf/utils';
644+
import FieldTemplate from './FieldTemplate';
622645

623646
const uiSchema: UiSchema = {
624-
'ui:FieldTemplate': CustomFieldTemplate,
647+
'ui:FieldTemplate': FieldTemplate,
648+
};
649+
```
650+
651+
or a string value from the `Registry` :
652+
653+
```tsx
654+
import { UiSchema } from '@rjsf/utils';
655+
656+
const uiSchema: UiSchema = {
657+
'ui:FieldTemplate': 'CustomFieldTemplate',
625658
};
626659
```
627660

@@ -693,16 +726,27 @@ render(
693726
);
694727
```
695728

696-
You also can provide your own field template to a uiSchema by specifying a `ui:ObjectFieldTemplate` property with your Component or a string value from the `Registry`.
729+
You also can provide your own field template to a uiSchema by specifying a `ui:ObjectFieldTemplate` property with your Component :
697730

698731
```tsx
699732
import { UiSchema } from '@rjsf/utils';
733+
import ObjectFieldTemplate from './ObjectFieldTemplate';
700734

701735
const uiSchema: UiSchema = {
702736
'ui:ObjectFieldTemplate': ObjectFieldTemplate,
703737
};
704738
```
705739

740+
or a string value from the `Registry` :
741+
742+
```tsx
743+
import { UiSchema } from '@rjsf/utils';
744+
745+
const uiSchema: UiSchema = {
746+
'ui:ObjectFieldTemplate': 'ObjectFieldTemplate',
747+
};
748+
```
749+
706750
Please see the [customObject.tsx sample](https://github.com/rjsf-team/react-jsonschema-form/blob/main/packages/playground/src/samples/customObject.tsx) from the [playground](https://rjsf-team.github.io/react-jsonschema-form/) for a better example.
707751

708752
The following props are passed to each `ObjectFieldTemplate` as defined by the `ObjectFieldTemplateProps` in `@rjsf/utils`:

0 commit comments

Comments
 (0)