Expandable pills require three elements to function correctly. These are a toggle state, a way to deactivate other pills, and a single shared container. This container holds the expanded content for all pills.
By Pawan Nayar · from the LLOS AI Learning record
Expandable pills require three elements to function correctly.
These are a toggle state, a way to deactivate other pills, and a single shared container. This container holds the expanded content for all pills.
Expandable pills need a toggle state. This state shows if a pill is open or closed. The pills also need a way to deactivate siblings. This means when one pill opens, others close. All expandable pills must share one container. This container sits below the group of pills. Using one container prevents too much code on the page.
A designer creates a webpage with a list of categories. Each category is an expandable pill. When a user clicks one category, its details appear below. Other open categories automatically close. This design uses one container for all category details, not a separate container for each one.
More from the same record, pulled by shared topic — not written new for this page.
A developer adds the main HTML structure for the 'Inspire' panel. This panel is 320 pixels wide.
A developer should never release an HTML page with basic, dark-themed styling. Even a temporary search tool must look good.
A text panel must have fewer than 60 words. Or, a text panel must have more than 95 words.
A prose field must have fewer than 60 words. Or, a prose field must have more than 95 words.
Expandable pills require three elements to function correctly. These are a toggle state, a way to deactivate other pills, and a single shared container. This container holds the expanded content for all pills.