Skip to main content

Supported Selectors

lui supports full CSS Level 4 selectors via lui-tree::query.

Combinators

CombinatorSyntaxSupport
DescendantA B
ChildA > B
Adjacent siblingA + B
General siblingA ~ B

Attribute Selectors

All operators with optional case sensitivity flags:

OperatorSyntaxSupport
Presence[attr]
Exact match[attr="val"]
Whitespace-separated[attr~="val"]
Exact or hyphen-prefix[attr|="val"]
Prefix[attr^="val"]
Suffix[attr$="val"]
Substring[attr*="val"]
Case-insensitive[attr="val" i]
Case-sensitive[attr="val" s]

Basic Selectors

SelectorSupport
Type/tag
Universal (*)
ID (#id)
Class (.class)✅ (multiple classes per element)

Logical Pseudo-classes

SelectorSupportNotes
:is()Specificity = most specific argument
:where()Zero specificity
:not()Specificity = most specific argument
:has()Relative selector, matched via subtree walk

Structural Pseudo-classes

SelectorSupportNotes
:root
:empty
:nth-child(an+b)Full formula support
:nth-last-child(an+b)
:first-child
:last-child
:only-child
:nth-of-type(an+b)
:nth-last-of-type(an+b)
:first-of-type
:last-of-type
:only-of-type

State Pseudo-classes

SelectorSupportNotes
:hoverVia InteractionState::hover_path
:activeVia InteractionState::active_path
:focusVia InteractionState::focus_path
:focus-withinIn query engine (not cascade yet)
:focus-visibleNot tracked
:disabledIn query engine (not cascade yet)
:enabledIn query engine
:checkedIn query engine (not cascade yet)
:requiredIn query engine
:optionalIn query engine
:read-onlyIn query engine
:read-writeIn query engine
:placeholder-shownIn query engine
:validIn query engine — checks required, minlength, maxlength, min/max/step
:invalidIn query engine — checks required, minlength, maxlength, min/max/step
:defaultIn query engine

Other Pseudo-classes

SelectorSupport
:lang()
:dir()
:scope

Pseudo-elements

SelectorSupportNotes
::beforeContent from content property
::afterContent from content property
::first-lineColor only
::first-letterColor only
::placeholderInput placeholder color
::selectionText selection colors
::file-selector-buttonFile input button
::lui-popup, ::lui-canvas, ::lui-inputInternal popup/picker pseudo-elements
::lui-calendar-*Calendar grid styling (~10 pseudo-elements)

Query Engine API

tree.query_selector("div.container > p:first-child");
tree.query_selector_all("input[type=text]:focus");
tree.query_selector_path("a.active");
tree.query_selector_all_paths("li:nth-child(odd)");

Node mirrors the same API for scoped queries relative to that node.