react-selectize icon indicating copy to clipboard operation
react-selectize copied to clipboard

Add option to customize "Add {label}..." string

Open stizzlestizzle opened this issue 8 years ago • 1 comments

Thanks for this plugin!

Currently, if createFromSearch is enabled and a new option is being entered by the user, the string Add {label}... is displayed. This string is hard-coded and the only way to override it is to provide a custom renderOption which seems overkill to me.

It would be nice to have an option to simply specify the desired string.

stizzlestizzle avatar Jan 15 '17 15:01 stizzlestizzle

<SimpleSelect
    ...
    renderOption={(arg) =>{
        var label, newOption, selectable, isSelectable;
        if (arg != null) {
            label = arg.label, newOption = arg.newOption, selectable = arg.selectable;
        }
        isSelectable = typeof selectable === 'undefined' || selectable;
        return (
            <div className={"simple-option " + (isSelectable ? '' : 'not-selectable')}>
                <span>{!!newOption ? "CUSTOM_LABEL" + label + "..." : label}</span>
            </div>
        )
    }}
/>

gabrielrosas avatar Mar 07 '17 17:03 gabrielrosas