mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
docs(dropdown): add example "Format item display text"
This commit is contained in:
parent
abe704dceb
commit
26276395e3
1 changed files with 10 additions and 0 deletions
|
@ -13,6 +13,16 @@ components: ["Dropdown", "DropdownSkeleton"]
|
||||||
{id: "1", text: "Email"},
|
{id: "1", text: "Email"},
|
||||||
{id: "2", text: "Fax"}]}" />
|
{id: "2", text: "Fax"}]}" />
|
||||||
|
|
||||||
|
### Format item display text
|
||||||
|
|
||||||
|
Use the `itemToString` prop to format the display of individual items.
|
||||||
|
|
||||||
|
<Dropdown itemToString={item => {
|
||||||
|
return item.text + ' (' + item.id +')'
|
||||||
|
}} titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
|
||||||
|
{id: "1", text: "Email"},
|
||||||
|
{id: "2", text: "Fax"}]}" />
|
||||||
|
|
||||||
### Light variant
|
### Light variant
|
||||||
|
|
||||||
<Dropdown light titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
|
<Dropdown light titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue