visibility attribute links the visibility of any HTML element with the visibility of a component. If the referenced component is shown or hidden, the element follows automatically - or, with :inverse, shows the opposite. A typical use case is showing/hiding headings, tab buttons, or container areas depending on ws-search-result.
The attribute can be set on any HTML element.
Prerequisite
- JavaScript bundle
ws-search-component-x.x.x.jsfrom version 1.9.1
Syntax
In the following notations,component stands for the name of the referenced component, source for a single source of a multi-source component, and name for the name of a filter:
Available as component references are: ws-search-result, ws-suggest-result, and ws-filter.
Examples
ws-search-resultws-suggest-result works analogously to ws-search-result, for example visibility="ws-suggest-result-category".
ws-filter
If
visibility refers to a component with multiple sources (for example visibility="ws-search-result" without a source suffix), the following applies: The element is visible when at least one source is visible, and is only hidden when all sources are hidden.Superseded attributes and workarounds
visibility replaces the previous mechanisms for controlling visibility. These continue to work but should no longer be used in new projects:
- hide-with (deprecated): behaves like
visibility="component", but does not support:inverse. - filter-container and suggest-container: workarounds that are replaced by
visibilitybut remain usable.
