Origami Frontend Components & Services

Readme: o-squishy-list

o-squishy-list has a support status of "deprecated". This means that no new features will be added to this component, but security-related bugs will be fixed. We do not recommend using this component in new projects. If you still rely on this component or have concerns, please contact the Origami team.

o-squishy-list has been deprecated. There are no direct alternatives; please contact the team if you would like to use this component.

Hides lowest priority items when space does not allow.



Given a root HTML element, o-squishy-list will assume each immediate element child is a content item.

Declaring content item priorities

The content items should be given a data-priority attribute containing a positive integer to indicate its priority with regard to display. The lower the number the higher the priority. Low-priority items will be hidden first, high-priority items will be hidden last.

Priority numbers do not have to start from 1 or be consecutive: the values 20, 34, 80 are valid and express the same relative priorities as 1, 2, 3.

Where multiple items share the same priority number, they will be hidden or shown at the same time. This allows declarative configuration of the behaviour - either all items hiding and showing at once, or each item hiding and showing individually - or a combination of the two.

If an item doesn't have a data-priority attribute, then it will be treated as lower priority than the lowest explicitly-set priority. Therefore if no items have the attribute, they will all hide and show together.

An example with four items using three levels of priority (the last item will be assumed to be priority 3):

    <li data-priority="2">Medium priority item</li>
    <li data-priority="1">High priority item</li>
    <li data-priority="2">Medium priority item</li>
    <li>Low priority item</li>

Sometimes you might want a particular content item to never be hidden. You can do this by setting its priority to -1 to remove it from the priorities list.


If some cases you might want a 'more' item which will only show when content has been hidden due to insufficient space. Simply add another <li> with a data-more attribute. It should also have a aria-hidden="true" attribute:

    <li data-priority="2">Medium priority item</li>
    <li data-priority="1">High priority item</li>
    <li data-priority="2">Medium priority item</li>
    <li>Low priority item</li>
    <li data-more aria-hidden="true">More</li>

When a More item element is present, sufficient content items will be hidden to make space for it to show. The width of the More item should not be allowed to change, as only the initial width is used for the content filtering calculations.

The More item will not be hidden, even if there is not sufficient space for it to show.

Hiding items manually

If you need to hide a list item manually via CSS or JS, you need to add the data-attribute data-o-squishy-list--ignore to that item. This way, o-squishy-list will stop adding that item to its item list.

<ul class="drop-off">
    <li data-priority="2" data-o-squishy-list--ignore="true">Ignore me</li>
    <li data-priority="1">Priority 1</li>
    <li data-priority="3">Priority 3</li>
    <li>No priority</li>


The root element should have minimum and maximum widths set.

Items are hidden using aria-hidden=true. Adding [aria-hidden="true"] { display: none; } to your CSS will ensure your nav items appear and disappear as expected.

In order to calculate the total width required, items must be set to display: inline-block or float: left.

Primary and core experience

When the JS has run, a data-o-squishy-list-js attribute will be set on the root element. This can be used in CSS selectors to target primary or core.

For core experience, it is recommended to style content items so that they can all be accessible when they are shown - e.g. via wrapping or scrolling.

The data-priority attributes could also be used in CSS selectors if you wanted to only show high-priority items in the core experience:

nav li:not([data-priority='1']) {
    display: none;



No code will run automatically.

An o-squishy-list object must be constructed for each container you want to filter.

var oSquishyList = require('o-squishy-list');

var nav = new oSquishyList(document.getElementsByTagName('ul'));

A optional second argument can be passed, containing a configuration object, with the following possible properties:



This module will dispatch the following events on its root element:

A common use-case for this module is a variable-width navigation, where as the available space narrows, navigation items 'drop off' and are added to an expanded 'drop-down' menu.

To achieve this, products should listen to the oSquishyList.change event, and use the included list of hidden items to determine what to add to the expandable drop-down menu.

For example:

document.getElementsByTagName('ul')[0].addEventListener('oSquishyList.change', function(ev) {
    if (ev.detail.hiddenItems.length > 0) {
        // Loop through ev.detail.hiddenItems array
        // Extract the useful data from each element & add it to the More Menu
}, false);


If you have any questions or comments about this component, or need help using it, please either raise an issue, visit #ft-origami or email Origami Support.


This software is published by the Financial Times under the MIT licence.

deprecated Origami v1 (Bower)
Switch component view

GitHub: o-squishy-list

Install o-squishy-list

If using the Build Service, add o-squishy-list@^2.4.6 to your script tag.

If using the npm package manager for a Manual Build, run npm install --save-peer "@financial-times/o-squishy-list@^2.4.6".

Help & Support

o-squishy-list is maintained directly by the Origami team. If you have any questions about o-squishy-list or Origami in general, we are happy to help. 😊

Slack: #ft-origami
Email: origami.support@ft.com

Feedback / Issues

To report a bug or request features please create an issue on Github. For support or general feedback please get in touch 😊

Slack: #ft-origami
Email: origami.support@ft.com