Description
Iterate.ArrayRemoveElementButton
connects to the array of a surrounding Iterate.Array
and removes the element when clicked.
Demos
Primitive elements
Code Editor
<Iterate.Arrayvalue={['One', 'Two', 'Three', 'Four', 'Five']}onChange={(value) => console.log('onChange', value)}><Layout.Row align="center"><Field.String elementPath="/" /><Iterate.ArrayRemoveElementButtonicon={TrashIcon}onChange={(value) => console.log('onChange', value)}/></Layout.Row></Iterate.Array>
Object elements
Code Editor
<DataContext.Providerdata={[{name: 'Iron Man',},{name: 'Captain America',},{name: 'Thor',},]}onChange={(value) => console.log('onChange', value)}><Iterate.Array path="/"><Layout.Row align="center"><Field.String elementPath="/name" /><Iterate.ArrayRemoveElementButton text="Remove avenger" /></Layout.Row></Iterate.Array></DataContext.Provider>
Properties
Property | Type | Description |
---|---|---|
text | string | (optional) Button text. |
children | ReactNode | (optional) Alternative to text for button contents. |
Events
Event | Description |
---|---|
onChange | (optional) Will be called on value changes made by the user, with the new value as argument. |
onFocus | (optional) Will be called when the component gets into focus. Like clicking inside a text input or opening a dropdown. Called with active value as argument. |
onBlur | (optional) Will be called when the component stop being in focus. Like when going to next field, or closing a dropdown. Called with active value as argument. |