Skip to content
This repository was archived by the owner on Apr 21, 2020. It is now read-only.

Commit 730bbb4

Browse files
author
Tobias Westfeld
committed
feat(web): document renderLabel-prop for Dropdowns
1 parent 84283b8 commit 730bbb4

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

content/docs/list-components/MultiDropdownList.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ Or you can also use render function as children
200200
```js
201201
renderNoResults={() => <p>No Results Found!</p>}
202202
```
203+
- **renderLabel** `Function` [optional]
204+
can be used to change the label of the dropdown. Useful for adding highlighting/styling to or translating the label.
205+
```js
206+
renderLabel={(items, placeholder) => Object.values(items).map((item) => (
207+
<div>
208+
<MyTranslationComponent key={item} />
209+
</div>
210+
))}
211+
```
203212
- **onChange** `function` [optional]
204213
is a callback function which accepts component's current **value** as a parameter. It is called when you are using the `value` prop and the component's value changes. This prop is used to implement the [controlled component](https://reactjs.org/docs/forms.html#controlled-components) behavior.
205214
- **onError** `Function` [optional]

content/docs/list-components/SingleDropdownList.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ Or you can also use render function as children
194194
```js
195195
renderNoResults={() => <p>No Results Found!</p>}
196196
```
197+
- **renderLabel** `Function` [optional]
198+
can be used to change the label of the dropdown. Useful for adding highlighting/styling to or translating the label.
199+
```js
200+
renderLabel={(item, placeholder) => (
201+
<div>
202+
<MyTranslationComponent key={item ? item : placeholder} />
203+
</div>
204+
)}
205+
```
197206
- **onChange** `function` [optional]
198207
is a callback function which accepts component's current **value** as a parameter. It is called when you are using the `value` prop and the component's value changes. This prop is used to implement the [controlled component](https://reactjs.org/docs/forms.html#controlled-components) behavior.
199208
- **onError** `Function` [optional]

0 commit comments

Comments
 (0)