Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react'
import { Dropdown } from 'semantic-ui-react'

const packageManagersOptions = [
{ key: 'gem', value: 'gem', icon: 'gem', text: 'RubyGems' },
{ key: 'npm', value: 'npm', icon: 'npm', text: 'NPM' },
{ key: 'docker', value: 'docker', icon: 'docker', text: 'Docker' },
]

const DropdownExampleSearchSelection = () => (
<Dropdown
placeholder='Select Package Manager'
fluid
search
selection
options={packageManagersOptions}
/>
)

export default DropdownExampleSearchSelection
9 changes: 8 additions & 1 deletion docs/src/examples/modules/Dropdown/Types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ const DropdownTypesExamples = () => (
description='A selection dropdown can allow a user to search through a large list of choices.'
examplePath='modules/Dropdown/Types/DropdownExampleSearchSelection'
/>
<ComponentExample examplePath='modules/Dropdown/Types/DropdownExampleSearchSelectionTwo' />
<ComponentExample
title='Search Selection with Text'
examplePath='modules/Dropdown/Types/DropdownExampleSearchSelectionTwo'
/>
<ComponentExample
title='Search Selection with Icon'
examplePath='modules/Dropdown/Types/DropdownExampleSearchSelectionIcon'
/>
{/* Possibly add state selection example. */}
<ComponentExample
title='Multiple Selection'
Expand Down
3 changes: 2 additions & 1 deletion src/modules/Dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const getKeyAndValues = (options) =>
options ? options.map((option) => _.pick(option, ['key', 'value'])) : options

function renderItemContent(item) {
const { flag, image, text } = item
const { flag, image, icon, text } = item

// TODO: remove this in v3
// This maintains compatibility with Shorthand API in v1 as this might be called in "Label.create()"
Expand All @@ -52,6 +52,7 @@ function renderItemContent(item) {
<>
{Flag.create(flag)}
{Image.create(image)}
{Icon.create(icon)}

{text}
</>
Expand Down