Skip to content

Remove the default "Create XXX" from options #4612

Answered by Rall3n
assaf-itzikson asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @assaf-itzikson,

do I understand you correctly, that you don't want the Create ... option? If so, I recommend not using the Creatable component and instead going for the default Select component, as the option is crucial for the functionality of the Creatable component and removing it would just leave unused code in your bundle.

If you just want the option to appear for certain conditions (e.g. value starting with @), I recommend using the isValidNewOption prop, which accepts a function as its value. This function gets the value of the search input as its first argument.

<Creatable isValidNewOption={(inputValue) => inputValue && inputValue.startsWith('@') && /* Check for existing va…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@assaf-itzikson
Comment options

@assaf-itzikson
Comment options

Answer selected by assaf-itzikson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants