iron-dropdown
An unstyled element that works similarly to a native browser select
<iron-dropdown>
<iron-dropdown>
displays content inside a fixed-position container,
positioned relative to another element.
See: Documentation, Demo.
Usage
Installation
npm install --save @polymer/iron-dropdown
In an HTML file
<html>
<head>
<script type="module">
import '@polymer/iron-dropdown/iron-dropdown.js';
</script>
<style>
#container {
display: inline-block;
}
iron-dropdown {
border: 1px solid gray;
background: white;
font-size: 2em;
}
</style>
</head>
<body>
<div id="container">
<button onclick="dropdown.open();">open the iron-dropdown</button>
<iron-dropdown id="dropdown" no-overlap>
<div slot="dropdown-content">Hello!</div>
</iron-dropdown>
</div>
</body>
</html>
In a Polymer 3 element
import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/iron-dropdown/iron-dropdown.js';
class SampleElement extends PolymerElement {
static get template() {
return html`
<style>
:host {
display: inline-block;
}
iron-dropdown {
border: 1px solid gray;
background: white;
font-size: 2em;
}
</style>
<button on-click="_openDropdown">open the dropdown</button>
<iron-dropdown id="dropdown" horizontal-align="right" vertical-align="top">
<div slot="dropdown-content">Hello!</div>
</iron-dropdown>
`;
}
_openDropdown() {
this.$.dropdown.open();
}
}
customElements.define('sample-element', SampleElement);
In the above example, the <div>
assigned to the dropdown-content
slot will
be hidden until the dropdown element has opened
set to true, or when the
open
method is called on the element.
Contributing
If you want to send a PR to this element, here are the instructions for running the tests and demo locally:
Installation
git clone https://github.com/PolymerElements/iron-dropdown
cd iron-dropdown
npm install
npm install -g polymer-cli
Running the demo locally
polymer serve --npm
open http://127.0.0.1:<port>/demo/
Running the tests
polymer test --npm
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Dependencies
- polymer#polymer/polymer#^1.0.0
- iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
- iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
- neon-animation#polymerelements/neon-animation#^1.0.0
- iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
- iron-image#polymerelements/iron-image#^1.0.0
- Released
- 2015-07-17
- Maturity
- IMPORTED
- License
- Other
Compatibility
- Framework
- Polymer 1.0+
- Polymer 2.0+ in 2.0.0
- Polymer 3.0+ in 0.0.1
- Browser
- Browser Independent
iron-dropdown - Vaadin Add-on Directory
An unstyled element that works similarly to a native browser selectIssue tracker
Online Demo
License
Documentation
View on NPM
View on GitHub
iron-dropdown version 1.0.0
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
* iron-image#polymerelements/iron-image#^1.0.0
iron-dropdown version 1.0.1
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
* iron-image#polymerelements/iron-image#^1.0.0
iron-dropdown version 1.0.2
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
* iron-image#polymerelements/iron-image#^1.0.0
iron-dropdown version 1.0.3
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
* iron-image#polymerelements/iron-image#^1.0.0
iron-dropdown version 1.0.4
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.0.5
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.0.6
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.1.0
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 0.0.1
### Dependencies
* @polymer/polymer#^1.2.5-npm-test.2
* @polymer/iron-behaviors#^0.0.1
* @polymer/iron-overlay-behavior#^0.0.1
* @polymer/iron-resizable-behavior#^0.0.1
* @polymer/neon-animation#^0.0.1
* @polymer/iron-a11y-keys-behavior#^0.0.1
iron-dropdown version 0.0.3
### Dependencies
* @polymer/polymer#^1.2.5-npm-test.2
* @polymer/iron-behaviors#^0.0.3
* @polymer/iron-overlay-behavior#^0.0.3
* @polymer/iron-resizable-behavior#^0.0.3
* @polymer/neon-animation#^0.0.3
* @polymer/iron-a11y-keys-behavior#^0.0.3
iron-dropdown version 1.2.0
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.3.0
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.3.1
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.4.0
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.4.1
### Dependencies
* polymer#polymer/polymer#^1.0.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.4.2
### Dependencies
* polymer#polymer/polymer#^1.1.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.5.0
### Dependencies
* polymer#polymer/polymer#^1.1.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
* iron-a11y-keys-behavior#polymerelements/iron-a11y-keys-behavior#^1.0.0
iron-dropdown version 1.5.1
### Dependencies
* polymer#polymer/polymer#^1.1.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.0.0
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
iron-dropdown version 1.5.2
### Dependencies
* polymer#polymer/polymer#^1.1.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.8.6
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
iron-dropdown version 1.5.3
### Dependencies
* polymer#polymer/polymer#^1.1.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.8.6
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
iron-dropdown version 1.5.4
### Dependencies
* polymer#polymer/polymer#^1.1.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.8.6
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
iron-dropdown version 1.5.5
### Dependencies
* polymer#polymer/polymer#^1.1.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.8.6
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
iron-dropdown version 1.5.6
### Dependencies
* polymer#polymer/polymer#^1.1.0
* iron-behaviors#polymerelements/iron-behaviors#^1.0.0
* iron-overlay-behavior#polymerelements/iron-overlay-behavior#^1.8.6
* iron-resizable-behavior#polymerelements/iron-resizable-behavior#^1.0.0
* neon-animation#polymerelements/neon-animation#^1.0.0
iron-dropdown version 2.0.0
### Dependencies
* polymer#Polymer/polymer#1.9 - 2
* iron-behaviors#PolymerElements/iron-behaviors#1 - 2
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#1 - 2
* neon-animation#PolymerElements/neon-animation#1 - 2
iron-dropdown version 3.0.0-pre.1
### Dependencies
* @polymer/polymer#^3.0.0-pre.1
* @polymer/iron-behaviors#^3.0.0-pre.1
* @polymer/iron-overlay-behavior#^3.0.0-pre.1
* @polymer/neon-animation#^3.0.0-pre.1
iron-dropdown version 2.1.0
### Dependencies
* polymer#Polymer/polymer#1.9 - 2
* iron-behaviors#PolymerElements/iron-behaviors#1 - 2
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^2.2.0
* neon-animation#PolymerElements/neon-animation#1 - 2
iron-dropdown version 3.0.0-pre.2
### Dependencies
* @polymer/polymer#^3.0.0-pre.1
* @polymer/iron-behaviors#^3.0.0-pre.1
* @polymer/iron-overlay-behavior#^3.0.0-pre.1
* @polymer/neon-animation#^3.0.0-pre.1
iron-dropdown version 3.0.0-pre.3
### Dependencies
* @polymer/polymer#^3.0.0-pre.3
* @polymer/iron-behaviors#^3.0.0-pre.3
* @polymer/iron-overlay-behavior#^3.0.0-pre.3
* @polymer/neon-animation#^3.0.0-pre.3
iron-dropdown version 3.0.0-pre.4
### Dependencies
* @polymer/polymer#^3.0.0-pre.4
* @polymer/iron-behaviors#^3.0.0-pre.4
* @polymer/iron-overlay-behavior#^3.0.0-pre.4
* @polymer/neon-animation#^3.0.0-pre.4
iron-dropdown version 3.0.0-pre.6
### Dependencies
* @polymer/polymer#^3.0.0-pre.6
* @polymer/iron-behaviors#^3.0.0-pre.6
* @polymer/iron-overlay-behavior#^3.0.0-pre.6
* @polymer/neon-animation#^3.0.0-pre.6
iron-dropdown version 3.0.0-pre.7
### Dependencies
* @polymer/polymer#^3.0.0-pre.7
* @polymer/iron-behaviors#^3.0.0-pre.7
* @polymer/iron-overlay-behavior#^3.0.0-pre.7
* @polymer/neon-animation#^3.0.0-pre.7
iron-dropdown version 3.0.0-pre.8
### Dependencies
* @polymer/polymer#^3.0.0-pre.7
* @polymer/iron-behaviors#^3.0.0-pre.7
* @polymer/iron-overlay-behavior#^3.0.0-pre.7
* @polymer/neon-animation#^3.0.0-pre.7
iron-dropdown version 2.2.0
### Dependencies
* polymer#Polymer/polymer#1.9 - 2
* iron-behaviors#PolymerElements/iron-behaviors#1 - 2
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^2.2.0
* neon-animation#PolymerElements/neon-animation#1 - 2
iron-dropdown version 3.0.0-pre.10
### Dependencies
* @polymer/polymer#^3.0.0-pre.10
* @polymer/iron-behaviors#^3.0.0-pre.10
* @polymer/iron-overlay-behavior#^3.0.0-pre.10
* @polymer/neon-animation#^3.0.0-pre.10
iron-dropdown version 3.0.0-pre.11
### Dependencies
* @polymer/polymer#^3.0.0-pre.10
* @polymer/iron-behaviors#^3.0.0-pre.10
* @polymer/iron-overlay-behavior#^3.0.0-pre.10
* @polymer/neon-animation#^3.0.0-pre.10
iron-dropdown version 3.0.0-pre.12
### Dependencies
* @polymer/polymer#3.0.0-pre.12
* @polymer/iron-behaviors#3.0.0-pre.12
* @polymer/iron-overlay-behavior#3.0.0-pre.12
* @polymer/neon-animation#3.0.0-pre.12
iron-dropdown version 3.0.0-pre.13
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/iron-behaviors#^3.0.0-pre.13
* @polymer/iron-overlay-behavior#^3.0.0-pre.13
* @polymer/neon-animation#^3.0.0-pre.13
iron-dropdown version 3.0.0-pre.14
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/iron-behaviors#^3.0.0-pre.14
* @polymer/iron-overlay-behavior#^3.0.0-pre.14
* @polymer/neon-animation#^3.0.0-pre.14
iron-dropdown version 3.0.0-pre.15
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/iron-behaviors#^3.0.0-pre.15
* @polymer/iron-overlay-behavior#^3.0.0-pre.15
* @polymer/neon-animation#^3.0.0-pre.15
iron-dropdown version 3.0.0-pre.16
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/iron-behaviors#^3.0.0-pre.16
* @polymer/iron-overlay-behavior#^3.0.0-pre.16
* @polymer/neon-animation#^3.0.0-pre.16
iron-dropdown version 3.0.0-pre.17
### Dependencies
* @polymer/polymer#^3.0.0-pre.13
* @polymer/iron-behaviors#^3.0.0-pre.17
* @polymer/iron-overlay-behavior#^3.0.0-pre.17
* @polymer/neon-animation#^3.0.0-pre.17
iron-dropdown version 3.0.0-pre.18
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.18
* @polymer/iron-overlay-behavior#^3.0.0-pre.18
* @polymer/neon-animation#^3.0.0-pre.18
iron-dropdown version 3.0.0-pre.19
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.19
* @polymer/iron-overlay-behavior#^3.0.0-pre.19
* @polymer/neon-animation#^3.0.0-pre.19
iron-dropdown version 2.2.1
### Dependencies
* polymer#Polymer/polymer#1.9 - 2
* iron-behaviors#PolymerElements/iron-behaviors#1 - 2
* iron-overlay-behavior#PolymerElements/iron-overlay-behavior#^2.2.0
* neon-animation#PolymerElements/neon-animation#1 - 2
iron-dropdown version 3.0.0-pre.20
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.20
* @polymer/iron-overlay-behavior#^3.0.0-pre.20
* @polymer/neon-animation#^3.0.0-pre.20
iron-dropdown version 3.0.0-pre.21
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.21
* @polymer/iron-overlay-behavior#^3.0.0-pre.21
* @polymer/neon-animation#^3.0.0-pre.21
iron-dropdown version 3.0.0-pre.22
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.20
* @polymer/iron-overlay-behavior#^3.0.0-pre.20
* @polymer/neon-animation#^3.0.0-pre.20
iron-dropdown version 3.0.0-pre.23
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.22
* @polymer/iron-overlay-behavior#^3.0.0-pre.23
* @polymer/neon-animation#^3.0.0-pre.22
iron-dropdown version 3.0.0-pre.24
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.22
* @polymer/iron-overlay-behavior#^3.0.0-pre.23
* @polymer/neon-animation#^3.0.0-pre.22
iron-dropdown version 3.0.0-pre.25
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.24
* @polymer/iron-overlay-behavior#^3.0.0-pre.25
* @polymer/neon-animation#^3.0.0-pre.24
iron-dropdown version 3.0.0-pre.26
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.25
* @polymer/iron-overlay-behavior#^3.0.0-pre.26
* @polymer/neon-animation#^3.0.0-pre.25
iron-dropdown version 3.0.0
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.26
* @polymer/iron-overlay-behavior#^3.0.0-pre.27
* @polymer/neon-animation#^3.0.0-pre.26
iron-dropdown version 3.0.1
### Dependencies
* @polymer/polymer#^3.0.0
* @polymer/iron-behaviors#^3.0.0-pre.26
* @polymer/iron-overlay-behavior#^3.0.0-pre.27
* @polymer/neon-animation#^3.0.0-pre.26