Open benjaminapetersen opened 9 years ago
Does it really make sense for paper-item
? I think it's supposed to be more of a general "item" for the paper components than an "option".
My guess would be that the child is irrelevant. It doesn't really matter if its a "div" or a "paper-item" or whatever. The important thing is that the dropdown probably needs a "selected" state it can track on a child element (of any appropriate type) to bring the interface to parity with a native html select box.
The following answer works for me: http://www.stackoverflow.dluat.com/questions/31982671/polymer-1-0-5-select-not-working-on-paper-dropdown-menu
Hope this help!
Interesting workaround. Still curious if this should be more straight forward/documented as the dropdown seems to mimic the select box in basic functionality (meaning I think this should probably be trivial).
I am having trouble to set default option. above solution only sets the selected item in menu but selected Items label is not shown.
Try using the fallbackSelection property for paper dropdown menu.
I used it like this, and it worked just fine!
<paper-dropdown-menu required label="Foo">
<paper-listbox attr-for-selected="value"
class="dropdown-content"
fallback-selection="0"
selected="{{fooVariable}}">
<paper-item value="0">A</paper-item>
<paper-item value="1">B</paper-item>
<paper-item value="2">C</paper-item>
<paper-item value="3">D</paper-item>
</paper-listbox>
</paper-dropdown-menu>
Used inside an iron-form.
This is a feature suggestion. Perhaps as an optional alternative to label, it seems like a default selected attribute could be place on one of the children, much like a native html select box:
This seems like an intuitive use of the component.