Collapsible content can help provide a great user experience on mobile devices, where screen space is restricted. An accordion UI component is a list of content sections, each of which can be in an expanded or collapsed state. You've probably seen accordions on the web before and maybe you've designed a web page that uses them. They're widely used on the web, with many different use cases, such as collapsing web page comment sections or for providing an expandable overview of article categories, in a news site, for example. We'll implement this latter use case shortly.
AMP comes with an extended component for building accordions: amp-accordion. Let's see how it works.
The examples in this chapter will build on the news article page from the previous chapter. The starting point can be found at /ch4...