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

Dropdown component #388

Closed
Closed
@miroslavstastny

Description

@miroslavstastny

Add basic implementation for Dropdown component.

image

API

For now, use an API similar to SUIR (example):

<Dropdown multiple search items={[ ... ]} />

Based on prototype in #334:

Since we only support "search" and "multiple", make these required for now.
Dropdown will only include the Input and associated List (menu), no buttons, field label, etc.

Separate active items from selected:

  • active means the item is in input box as an active value
  • selected means the item is highlighted in the menu

More keyboard handlers:

  • click to open
  • esc to close

API Proposal

className

Additional classes.

fluid

Boolean to make it stretch as much as container allows.

items

Shorthand to provide items in the dropdown. Similar to providing ListItems as shorthand inside list.
screen shot 2018-10-25 at 11 16 27

label

Shorthand to provide a label before the dropdown.
screen shot 2018-10-25 at 11 16 48

multiple

Boolean to provide multi-selection functionality. Will add the active shorthands as Labels before the Input, each with 'X' icon for removal.
screen shot 2018-10-25 at 11 17 33

onChange

Callback provided to allow user to handle change. Invoked with the props and also with the active option(s), which can be either the shorthand for the active item, or the shorthand collection for the active items.

onInput

Callback provided to allow user to handle input change in the edit text. Only makes sense if dropdown is a search. Invoked with both the props and the new value of the text in the input.

placeholder

Text to act as placeholder, optional, in case the dropdown is a search (with text field). Makes sense only if dropdown is a search.
screen shot 2018-10-25 at 11 17 40

search

Boolean to make the dropdown able to search through the options, with autosuggestions. If false, the search input will be replaced by trigger button.

styles

Styles that are applied on top of the default ones.

variables

Variables that are applied on top of the default ones.

Metadata

Metadata

Assignees

Labels

vstsPaired with ticket in vsts⚙️ enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions