(react) add select multi options custom render

We want to be able to render the options in a customized manner.
This commit is contained in:
Nathan Vasse
2023-10-06 16:55:30 +02:00
committed by NathanVss
parent 48e4e56a44
commit b86ba5cc8e
6 changed files with 295 additions and 8 deletions

View File

@@ -88,6 +88,19 @@ For some reasons you might want to hide the label of the Multi-Select. You can d
<Story id="components-forms-select-multi--hidden-label"/>
</Canvas>
## Custom render option
You can give customize the look of the options by providing `render` callback.
> When you provide `render` the fields `label` and `value` are mandatory.
Feel free to use the attribute `showLabelWhenSelected` to choose whether you want to display selected option with the custom
HTML or with its `label`. It is set to `true` by default.
<Canvas sourceState="shown">
<Story id="components-forms-select-multi--searchable-custom-render"/>
</Canvas>
## Controlled / Non Controlled
Like a native select, you can use the Select component in a controlled or non controlled way. You can see the example below