This chapter looks at how to deliver better user experiences with the interactive components available in AMP. Our example article page is beginning to look nice and enticing, but so far there has been no way for visitors to interact with it. Building on our example, we'll learn how to add more interactive UI components that will both help to improve the user experience and improve how the site design looks.
All the techniques in this chapter have two things in common that help to enhance the user experience:
- They require some kind of interaction or trigger from the user
- They are designed to make the most of the limited screen space available on mobile devices
Topics covered in Chapter 4 include the following:
- Creating collapsible content sections with
<amp-accordion>
- Building navigation menus with
<amp-sidebar>
and <amp-carousel> - Building tabbed content with
<amp-selector>
- How to generate dismissable pop-up user notifications with
<amp-usernotification>
- The Action and Event model in AMP
Buy "AMP: Building Accelerated Mobile Pages" on Amazon US, Amazon UK
View Examples
- Starting point for examples: news-start.html
- Accordion example: accordion.html
- Fancy accordion example: accordion-2.html
- Even fancier accordion: accordion-3.html
- HTML based nav menu:nav-div.html
- AMP nav menu using
<amp-carousel>
nav-carousel.html - Simple sidebar nav menu: sidebar.html
- Styled sidebar nav menu: sidebar-2.html
- Sidebar nav menu with SVG buttons: sidebar-3.html
- Sidebar nav menu with accordion submenu: sidebar-4.html
- Simple tabbed UI: tabs.html
- Styled tabbed UI: tabs-2.html
Download code
Download all code for this chapter: ch4.zip