Name | Type | Default | Description |
---|---|---|---|
children required | (item: unknown, index: number) => ReactNode | A render function called for each item passed in the `value` prop.
| |
newItem required | unknown | The default value each new item should have | |
addDisabledTooltip | string | 'There is already an empty item' | The tooltip text displayed when hovering over the disabled add item button |
addLabel | string | "Add item" | The label of the add item button |
allowAdd | (values: unknown[]) => boolean | Function that determines if the add item button should be enabled given the current items of the collection.
The button is always enabled if this props remains undefined
| |
description | ReactNode | Input description, displayed after label | |
descriptionProps | Record<string, any> | Props spread to description element | |
disabled | boolean | false | Whether the collection is disabled, or in other words in read only mode |
draggable | boolean | false | Whether the collection should have drag and drop behavior enabled |
error | ReactNode | Displays error message after input | |
errorProps | Record<string, any> | Props spread to error element | |
getItemId | (originalItem: unknown) => string | Defines how each item is uniquely identified. It is highly recommended that you specify this prop to an ID that makes sense.
This method is required when using this component with ReactHookForm.
| |
label | ReactNode | Input label, displayed before input | |
labelProps | Record<string, any> | Props spread to label element | |
onChange | (value: unknown[]) => void | Function called whenever the value needs to be updated
| |
onFocus | () => void | Unused, has no effect | |
onInsertItem | (value: unknown, index: number) => void | Function that gets called when a new item needs to be added to the collection
| |
onRemoveItem | (itemIndex: number) => void | Function called after an item is removed from the collection using the remove button
| |
onReorderItem | (payload: ReorderPayload) => void | Function that gets called whenever a collection item needs to be reordered
| |
required | boolean | false | Whether the collection is required. When required is true, the collection will hide the remove button if there is only one item |
spacing | MantineNumberSize | 'xs' | The spacing between the colleciton items |
value | unknown[] | [] | The list of items to display inside the collection |
withAsterisk | boolean | Determines whether required asterisk should be rendered, overrides required prop, does not add required attribute to the input |
No guidelines exist for Collection yet.