<amp-selector id="" class="flex flex-wrap" role="tablist" on="select:AMP.setState({selectedTab: event.targetOption})" [selected]="">
<button class="button _secondary ma300 " option="a" selected>
Tab One
</button>
<div id="" class=" db order-1 pa300 w-100p" role="tabpanel">
<p id="" class="">
Tab One content woo hoo wow
</p>
</div>
<button class="button _secondary ma300 " option="b">
Tab Two
</button>
<div id="" class=" db order-1 pa300 w-100p" role="tabpanel">
<p id="" class="">
Tab Two content woo hoo wow
</p>
</div>
<button class="button _secondary ma300 " option="c">
Tab three
</button>
<div id="" class=" db order-1 pa300 w-100p" role="tabpanel">
<p id="" class="">
Tab three content woo hoo wow
</p>
</div>
</amp-selector>
<amp-state id="State">
<script type="application/json">
{
selectedTab:
}
</script>
</amp-state>
<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": "flex flex-wrap",
"style": null,
"role": "tablist",
"selectorlayout": null,
"on": "select:AMP.setState({selectedTab: event.targetOption})",
"state": "selectedTab",
"statevalue": null,
"multiple": null,
"selected": true,
"children": [
{
"component": "button",
"context": {
"modifier": "_secondary ma300",
"text": "Tab One",
"option": "a",
"selected": true
}
},
{
"component": "div",
"context": {
"role": "tabpanel",
"modifier": "db order-1 pa300 w-100p",
"children": [
{
"component": "p",
"context": {
"text": "Tab One content woo hoo wow"
}
}
]
}
},
{
"component": "button",
"context": {
"modifier": "_secondary ma300",
"text": "Tab Two",
"option": "b"
}
},
{
"component": "div",
"context": {
"role": "tabpanel",
"modifier": "db order-1 pa300 w-100p",
"children": [
{
"component": "p",
"context": {
"text": "Tab Two content woo hoo wow"
}
}
]
}
},
{
"component": "button",
"context": {
"modifier": "_secondary ma300",
"text": "Tab three",
"option": "c"
}
},
{
"component": "div",
"context": {
"role": "tabpanel",
"modifier": "db order-1 pa300 w-100p",
"children": [
{
"component": "p",
"context": {
"text": "Tab three content woo hoo wow"
}
}
]
}
}
],
"layout": "container"
}
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.