Implementing tabbed content with <amp-selector>
Another widely used and intuitive UI pattern is tabbed content. Tabs provide different views within a context. There are many use cases for tabs. In e-commerce, they can be used to provide information about different aspects of a product, such as the product overview, product specifications, and product reviews. Many popular news sites use tabs to display lists of Most read and Top stories article lists that you can switch between. Let's add this to our news article example page: we'll have Related content
in one tab, and Most read
in another.
While tabbed content is not supported out of the box with a dedicated component, it can be implemented in AMP with the use of the amp-selector
custom element. This is a component that displays a list of options that the user can choose from.
Include it with the following:
<script async custom-element="amp-selector" src="https://cdn.ampproject.org/v0/amp-selector-0.1.js"></script>
There are...