module.exports = { id: 'visibility-helpers', title: 'Visibility helpers', keywords: ['hidden', 'visibility', 'visually-hidden', 'accessibility', 'utility'], description: '
You can use visibility helper classes to hide elements for all users (.hidden
) or for users not on screen readers (.visually-hidden
). There are also responsive visibility helpers provided, for hiding or visually hiding content only for specific screen sizes (.hidden-sm
, .hidden-md
, .hidden-lg
and .visually-hidden-sm
, .visually-hidden-md
and .visually-hidden-lg
respectively).
<p class="hidden">Not visible for any users.</p> <p class="visually-hidden">Visible only for screen readers.</p> <p class="hidden-sm">Not visible for users on screens under 768px wide.</p> <p class="hidden-md">Not visible for users on screens 768px-1280px wide.</p> <p class="hidden-lg">Not visible for users on screens wider than 1280px.</p> <p class="visually-hidden-sm">Visible only for screen readers under 768px wide.</p> <p class="visually-hidden-md">Visible only for screen readers 768px-1280px wide.</p> <p class="visually-hidden-lg">Visible only for screen readers wider than 1280px.</p>`], notes: [ 'Visibility helpers use
!important
declarations to override any other styles, so exercise caution when using them.',
'The specific breakpoints for small, medium and large screen sizes are as follows:768px
wide768px
wide and less than 1280px
wide1280px
wide or more<p class="hidden-sm hidden-md">Not visible for users on screens under 1280px wide.</p>
`
}
],
donts: [
{
description: `Avoid combining .hidden
and .visually-hidden
or responsive helpers for the same screen size.`,
sample: `<p class="hidden visually-hidden">Do not do this.</p>
`
}
]
}