Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add placeholder property to mi-dropdown #390

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions packages/components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@ export namespace Components {
* @type {boolean}
*/
"open": boolean;
/**
* If present, it dictates placeholder for an filterable input field in the dropdown. Defaults to 'Type to filter...'.
* @type {string}
*/
"placeholder": string;
/**
* Gets the selected items.
* @type {Array<HTMLMiDropdownItemElement>}
Expand Down Expand Up @@ -1616,6 +1621,11 @@ declare namespace LocalJSX {
* @type {boolean}
*/
"open"?: boolean;
/**
* If present, it dictates placeholder for an filterable input field in the dropdown. Defaults to 'Type to filter...'.
* @type {string}
*/
"placeholder"?: string;
/**
* Gets the selected items.
* @type {Array<HTMLMiDropdownItemElement>}
Expand Down
10 changes: 9 additions & 1 deletion packages/components/src/components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ export class Dropdown {
*/
@Prop() filterable = false;


/**
* If present, it dictates placeholder for an filterable input field in the dropdown. Defaults to 'Type to filter...'.
*
* @type {string}
*/
@Prop() placeholder: string;
ammapspeople marked this conversation as resolved.
Show resolved Hide resolved

/**
* This attribute indicates that multiple items can be selected in the list. If it is not specified, then only one item can be selected at a time.
*
Expand Down Expand Up @@ -591,7 +599,7 @@ export class Dropdown {
return (
<div class="filter">
<input type="text" class="mi-input filter__input"
placeholder="Type to filter"
placeholder={this.placeholder ? this.placeholder : 'Type to filter...'}
ref={(el): HTMLInputElement => this.filterElement = el}
onInput={(): void => { this.filter(); }}
tabIndex={this.open ? 0 : -1} />
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/dropdown/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ mi-dropdown::part(button) {
| `multiple` | `multiple` | This attribute indicates that multiple items can be selected in the list. If it is not specified, then only one item can be selected at a time. | `boolean` | `false` |
| `noResultsMessage` | `no-results-message` | Guiding message when presented with a content window that has no rows. Default language is English. | `string` | `'No results found'` |
| `open` | `open` | Gets or sets the state of the dropdown. If the attribute is set to true then the dropdown will be expanded. | `boolean` | `false` |
| `placeholder` | `placeholder` | If present, it dictates placeholder for an filterable input field in the dropdown. Defaults to 'Type to filter...'. | `string` | `undefined` |
| `selected` | -- | Gets the selected items. | `HTMLMiDropdownItemElement[]` | `[]` |


Expand Down
Loading