Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom creatable and searchable labels in Pickers #1565

Closed
iSplasher opened this issue Mar 12, 2021 · 3 comments
Closed

Allow custom creatable and searchable labels in Pickers #1565

iSplasher opened this issue Mar 12, 2021 · 3 comments

Comments

@iSplasher
Copy link

What problem does this feature solve?

I am using v5.

This feature would allow for a more appropriate label that suits the context. Imagine an InputPicker like this

billede

In my case a more appropriate label would be Create gender "Other".
This would also help if you decide to use a custom localization solution outside of rsuite.

I hope this could also be applied to the other related picker components.

What does the proposed API look like?

Maybe something like this?

<InputPicker
      creatable
      creatableLabel="Create gender"
      data={data}
    />

Or for maximum flexibility, allow passing a template string:

<InputPicker
      creatable
      creatableLabel="Create gender ${value}"
      data={data}
    />
@iSplasher iSplasher changed the title Allow custom creatable and searchable text in Pickers Allow custom creatable and searchable labels in Pickers Mar 12, 2021
@iSplasher
Copy link
Author

If you would like then I can create a PR for this

@simonguo
Copy link
Member

You can modify the locales configuration to meet your business scenarios.
https://github.com/rsuite/rsuite/blob/next/src/locales/en_US.ts#L55

In addition, you can also just modify the locale of InputPicker.

<InputPicker
  locale={{createOption: "Create gender ${0}" }}
/>

@iSplasher
Copy link
Author

Wow yes thank you, I missed that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants