The Get Started guide present basic selectors which are plenty enough in most cases. However, linne comes with some more sophisticated ones if needed.
Below are the basic selectors available in linne.
sel_id()- Select an object by its id, e.g.:
sel_all()- Selects everything, will apply a change to every element of the page.
sel_input()- Selects an input by its id, e.g.:
sel_class()- Select all elements bearing a specific class, e.g.:
shiny::h1('hello', class = 'cls').
sel_tag()- Select all tags, e.g.:
sel_attr()- Select all tags with a specific attribute.
You can also use some special operators to broaden or narrow down the selection.
%child%- Selects elements where right hand is child of left hand, e.g.:
sel_tag('div') %child% sel_class('aClass')selects elements with
aClasswho are direct children of
%or%- Select left hand or right hand, e.g.:
sel_id('myId') %or% sel_class('myClass')will select both the element with the id and elements with the class. Ideal to select and apply changes multiple elements at once.
%with%- Left hand selector with right hand selector, e.g.:
sel_tag('div') %with% sel_class('aClass')selects a
divwith a class of
aClass. Ideal to narrow down the selection.
You can also use the
when_* family of functions to narrow the selection based on the state of the element.
when_active()- Only select only active links.
when_hover()- Only select when the element is hovered.
when_focus()- Only select when the elements is focused.