Query is a library built specifically for web components to make it easy to interact with a page’s DOM and shadow DOM in a chainable way.
Usage Guide If you are new to Query it is recommended you check out the user guide before reading the API references.
Installation
Query can be used as a standalone package or alongside templating and other core features.
npm install @semantic-ui/query
Query Sections
The Query library is organized into several categories:
- Setup - Module exports and environment configuration.
- Constructor - Creating Query collections from selectors, elements, and HTML.
- Attributes - Accessing attributes.
- Components - Accessing UI components.
- Content - Accessing DOM content.
- CSS - Getting and setting CSS values.
- Dimensions - Getting and setting width, height, scroll, and natural size.
- Display & Visibility - Showing, hiding, and checking element visibility.
- DOM Manipulation - Inserting, removing, or creating DOM content.
- DOM Traversal - Traversing the DOM to access content.
- Events - Binding, triggering and removing events.
- Iterators - Looping through DOM elements to execute a function, filter, or map.
- Logical Operators - Modifying a query collection using selectors or functions.
- Position & Intersection - Getting element positions and checking spatial relationships.
- Utilities - Utilities for manipulating the query object.
- Internal Helpers - Internal methods used by the Query library