<amp-selector id="" class="">
<button class="button ">
click me!
</button>
<button class="button ">
no click me!
</button>
</amp-selector>
<amp-selector
id="{{id}}"
class="{{modifier}}"
{{#if role}}role="{{role}}"{{/if}}
{{#if selectorlayout}}layout="{{selectorlayout}}"{{/if}}
{{#if name}}name="{{name}}"{{/if}}
{{#if on}}on="{{on}}"{{/if}}
{{#if multiple}}multiple{{/if}}
{{#if selected}}[selected]="{{statevalue}}"{{/if}}
>
{{> @children}}
</amp-selector>
{{#if state}}
<amp-state id="{{id}}State">
<script type="application/json">
{
{{state}}: {{statevalue}}
}
</script>
</amp-state>
{{/if}}
{
"id": null,
"modifier": null,
"style": null,
"role": null,
"selectorlayout": null,
"on": null,
"state": null,
"statevalue": null,
"multiple": null,
"selected": null,
"children": [
{
"component": "button",
"context": {
"text": "click me!"
}
},
{
"component": "button",
"context": {
"text": "no click me!"
}
}
]
}
amp-selector {
[role="tabpanel"] {
display: none;
}
[selected] + [role="tabpanel"] {
display: block;
}
}
Represents a control that presents a menu of options and lets the user choose from it.
More information can be found in the AMP documentation.
<script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-0.1.js"></script>
The AMP selector is a control that presents a list of options and lets the user choose one or many options; the contents of the options aren’t just limited to text.
<li option='value'></li>
).<li option='d' disabled></li>
).<li option='b' selected></li>
).AMPSelector is accessible by keyboard and screenreader users according to WCAG 2.0 guidelines.