x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<div id="autocomplete" data-controller="paper-autocomplete" data-paper-autocomplete-selected-value="[]"> <div data-paper-autocomplete-target="popover" data-controller="paper-popover" data-paper-popover-append-to-body-value="false" data-paper-popover-active-value="false" data-paper-popover-placement-value="auto-start" data-paper-popover-open-class="Polaris-Popover__PopoverOverlay--open" data-paper-popover-closed-class="Polaris-Popover__PopoverOverlay--closed"> <div data-paper-popover-target="activator"> <div class=""> <div class="Polaris-Labelled__LabelWrapper"> <div class="Polaris-Label"> <label class="Polaris-Label__Text" for="tags">Tags</label> </div> </div> <div class="Polaris-Connected"> <div class="Polaris-Connected__Item Polaris-Connected__Item--primary"> <div data-paper-text-field-has-value-class="Polaris-TextField--hasValue" data-paper-text-field-clear-button-hidden-class="Polaris-TextField__Hidden" data-action="click->paper-autocomplete#toggle click@window->paper-popover#hide" data-controller="paper-text-field" class="Polaris-TextField"> <div class="Polaris-TextField__Prefix"> <span class="Polaris-Icon"> <svg viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" class="Polaris-Icon__Svg" focusable="false" aria-hidden="true"><path d="M8 12a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm9.707 4.293-4.82-4.82a5.968 5.968 0 0 0 1.113-3.473 6 6 0 0 0-12 0 6 6 0 0 0 6 6 5.968 5.968 0 0 0 3.473-1.113l4.82 4.82a.997.997 0 0 0 1.414 0 .999.999 0 0 0 0-1.414z"></path></svg> </span> </div> <input type="text" name="tags" id="tags" placeholder="Search" data-paper-text-field-target="input" data-paper-autocomplete-target="input" data-action="paper-text-field#syncValue" class="Polaris-TextField__Input" /> <div class="Polaris-TextField__Backdrop"></div> </div> </div> </div> </div> </div> <div data-paper-popover-target="popover" class="Polaris-PositionedOverlay Polaris-Popover__PopoverOverlay Polaris-Popover__PopoverOverlay--closed"> <div class="Polaris-Popover Polaris-Popover--fullWidth"> <div class="Polaris-Popover__FocusTracker" tabindex="0"></div> <div style="--pc-box-background: var(--p-color-bg);--pc-box-border-color: transparent;--pc-box-border-style: solid;--pc-box-border-radius: var(--p-border-radius-2);--pc-box-overflow-x: hidden;--pc-box-overflow-y: hidden;position: relative" class="Polaris-Box"> <div tabindex="-1" class="Polaris-Popover__Content"> <div data-paper-scrollable-shadow-value="true" data-paper-scrollable-top-shadow-class="Polaris-Scrollable--hasTopShadow" data-paper-scrollable-bottom-shadow-class="Polaris-Scrollable--hasBottomShadow" data-controller="paper-scrollable" style="" class="Polaris-Popover__Pane Polaris-Scrollable Polaris-Scrollable--vertical"> <span data-paper-scrollable-target="topEdge"></span> <ul data-paper-autocomplete-target="results" data-controller="paper-option-list" data-paper-option-list-selected-class="Polaris-OptionList-Option--select" style="--pc-box-border-color: transparent;--pc-box-border-style: solid;--pc-box-padding-block-end-xs: var(--p-space-2);--pc-box-padding-block-start-xs: var(--p-space-2);--pc-box-padding-inline-end-xs: var(--p-space-2);--pc-box-padding-inline-start-xs: var(--p-space-2)" class="Polaris-Box Polaris-Box--listReset"> <li data-paper-autocomplete-target="option" data-label="Rustic" tabindex="-1" class="Polaris-OptionList-Option"><label class="Polaris-OptionList-Option__SingleSelectOption" data-paper-option-list-target="radioButton" data-action="click->paper-option-list#update"><input type="radio" id="_rustic" value="rustic" data-action="paper-autocomplete#select" aria-checked="false" class="Polaris--hidden" />Rustic</label></li> <li data-paper-autocomplete-target="option" data-label="Antique" tabindex="-1" class="Polaris-OptionList-Option"><label class="Polaris-OptionList-Option__SingleSelectOption" data-paper-option-list-target="radioButton" data-action="click->paper-option-list#update"><input type="radio" id="_antique" value="antique" data-action="paper-autocomplete#select" aria-checked="false" class="Polaris--hidden" />Antique</label></li> <li data-paper-autocomplete-target="option" data-label="Vinyl" tabindex="-1" class="Polaris-OptionList-Option"><label class="Polaris-OptionList-Option__SingleSelectOption" data-paper-option-list-target="radioButton" data-action="click->paper-option-list#update"><input type="radio" id="_vinyl" value="vinyl" data-action="paper-autocomplete#select" aria-checked="false" class="Polaris--hidden" />Vinyl</label></li> <li data-paper-autocomplete-target="option" data-label="Vintage" tabindex="-1" class="Polaris-OptionList-Option"><label class="Polaris-OptionList-Option__SingleSelectOption" data-paper-option-list-target="radioButton" data-action="click->paper-option-list#update"><input type="radio" id="_vintage" value="vintage" data-action="paper-autocomplete#select" aria-checked="false" class="Polaris--hidden" />Vintage</label></li> <li data-paper-autocomplete-target="option" data-label="Refurbished" tabindex="-1" class="Polaris-OptionList-Option"><label class="Polaris-OptionList-Option__SingleSelectOption" data-paper-option-list-target="radioButton" data-action="click->paper-option-list#update"><input type="radio" id="_refurbished" value="refurbished" data-action="paper-autocomplete#select" aria-checked="false" class="Polaris--hidden" />Refurbished</label></li> </ul> <span data-paper-scrollable-target="bottomEdge"></span> </div> </div> </div> <div class="Polaris-Popover__FocusTracker" tabindex="0"></div> </div> </div> </div></div><script> const element = document.getElementById('autocomplete'); element.addEventListener('paper-autocomplete:change', ({detail}) => { alert(`Selected ${detail.value}`); });</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<%= paper_autocomplete(id: "autocomplete") do |autocomplete| %> <% autocomplete.with_text_field(name: :tags, label: "Tags", placeholder: "Search") do |c| %> <% c.with_prefix do %> <%= paper_icon(name: "SearchMinor") %> <% end %> <% end %> <% autocomplete.with_option(label: "Rustic", value: "rustic") %> <% autocomplete.with_option(label: "Antique", value: "antique") %> <% autocomplete.with_option(label: "Vinyl", value: "vinyl") %> <% autocomplete.with_option(label: "Vintage", value: "vintage") %> <% autocomplete.with_option(label: "Refurbished", value: "refurbished") %><% end %><script> const element = document.getElementById('autocomplete'); element.addEventListener('paper-autocomplete:change', ({detail}) => { alert(`Selected ${detail.value}`); });</script>
No notes provided.
No params configured.