This repository was archived by the owner on Jun 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
example/src/examples/custom-array Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
- {}
1
+ {
2
+ "ui:options" : {
3
+ "addButtonLabel" : " Custom add label"
4
+ }
5
+ }
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import { AddButtonProps } from 'react-jsonschema-form';
5
5
import Button from '@material-ui/core/Button' ;
6
6
import AddIcon from '@material-ui/icons/Add' ;
7
7
8
- const AddButton : React . FC < AddButtonProps > = props => (
8
+ // TODO: Add label property on type definition
9
+ const AddButton : React . FC < AddButtonProps & { label ?: string } > = props => (
9
10
< Button { ...props } color = "secondary" >
10
11
< AddIcon /> { props . label || 'Add Item' }
11
12
</ Button >
Original file line number Diff line number Diff line change @@ -193,7 +193,11 @@ const DefaultNormalArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
193
193
className = "array-item-add"
194
194
onClick = { props . onAddClick }
195
195
disabled = { props . disabled || props . readonly }
196
- label = { props . uiSchema . buttonLabel }
196
+ { ...( props . uiSchema [ 'ui:options' ] && {
197
+ label : props . uiSchema [ 'ui:options' ] [
198
+ 'addButtonLabel'
199
+ ] as string ,
200
+ } ) }
197
201
/>
198
202
</ Box >
199
203
</ Grid >
You can’t perform that action at this time.
0 commit comments