On This Page
Query - Components
Access and configure Semantic UI web components through Query.
Instances
component
$('selector').component()Retrieves the component instance from a web component.
Returns
Component instance, or undefined if not found.
Example
initialize
$('selector').initialize(settings)Initializes a component with settings before it renders in the DOM.
Parameters
| Name | Type | Description |
|---|---|---|
| settings | object | Setting key-value pairs |
Returns
Query object for chaining.
Example
Settings
settings
$('selector').settings()$('selector').settings(newSettings)Gets or sets component settings. Useful for passing data that cannot be stringified into attributes.
Parameters
| Name | Type | Description |
|---|---|---|
| newSettings | object | Settings to apply |
Returns
Settings object when getting, Query object when setting.
Example
setting
$('selector').setting(name)$('selector').setting(name, value)Gets or sets a single component setting.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | Name of the setting |
| value | any | Value to set |
Returns
Setting value when getting, Query object when setting.
Example
Data
dataContext
$('selector').dataContext()Retrieves the data context associated with a component.
Returns
Data context object, or undefined if not found.
Example
update
$('selector').update(data)Brings each matched component’s template to data, which defaults to the element’s current settings. A declared setting moves through its signal. Every other key is plain data, re-evaluated wherever the template reads it.
Parameters
| Name | Type | Description |
|---|---|---|
| data | object | Keys to merge into each component’s template data context |
Returns
Query object for chaining.