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';
55import Button from '@material-ui/core/Button' ;
66import AddIcon from '@material-ui/icons/Add' ;
77
8- const AddButton : React . FC < AddButtonProps > = props => (
8+ // TODO: Add label property on type definition
9+ const AddButton : React . FC < AddButtonProps & { label ?: string } > = props => (
910 < Button { ...props } color = "secondary" >
1011 < AddIcon /> { props . label || 'Add Item' }
1112 </ Button >
Original file line number Diff line number Diff line change @@ -193,7 +193,11 @@ const DefaultNormalArrayFieldTemplate = (props: ArrayFieldTemplateProps) => {
193193 className = "array-item-add"
194194 onClick = { props . onAddClick }
195195 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+ } ) }
197201 />
198202 </ Box >
199203 </ Grid >
You can’t perform that action at this time.
0 commit comments