Iโve always wanted the ability to only display list items when the user is actively searching for something.
Without CSS, the only way to do this will be to use a user specific text column, followed by a query, and then displaying a list with that query as the source.
However, with custom CSS, you can use the :has(.is-searching-something) pseudo class with some visibility styling on any type of collection to provide the same experience without any additional data columns!
Steps:
- Create a collection and give it a custom class (eg.
listSearch) - Add this CSS in Settings โ Appearance
Note: Iโm targeting a Table Collection, so Iโm using the[class*=โnew-table-libโ]class. Other Collection types will have a different class to target.
.listSearch:not(:has(.is-searching-something)) [class*="new-table-lib"] {
display: none;
}
v2
![]()
visibility:hidden style still retains component height even though thereโs hidden content.
.listSearch:not(:has(.is-searching-something)) [class*="new-table-lib"] {
visibility: hidden;
}
v1
Can be combined into a singular CSS block using the :not(:has()) pseudo class.
.listSearch [class*="new-table-lib"] {
visibility: hidden;
}
.listSearch:has(.is-searching-something) [class*="new-table-lib"] {
visibility: visible;
}
๐ CSS to hide any list UNTIL you search! - #2 by Himaladin
Take a look at the video below for the end effect!