Enter a search term above to see results...
On This Page
Web Component Base
WebComponentBase
is the base web component class used to create web components with defineComponent
. It handles internal utilities related to component lifecycle and other internals of the framework.
Advanced Use Only - It is not recommended to use this base class directly except in use cases where you want to create custom web components without
defineComponent
Import
Static Properties
Name | Type | Description |
---|---|---|
shadowRootOptions | Object | Options for the shadow root, including delegatesFocus |
scopedStyleSheet | CSSStyleSheet | Scoped stylesheet for use with light DOM rendering |
Instance Properties
Name | Type | Description |
---|---|---|
renderCallbacks | Array | Array of callbacks to be executed after rendering |
Static Methods
getProperties
Defines property configurations for a web component.
Parameters
Name | Type | Description |
---|---|---|
properties | Object | Initial properties configuration |
settings | Object | Component settings configuration |
componentSpec | Object | Component specification object |
Returns
An object containing the configured properties.
Example
getPropertySettings
Creates property configuration for a single property.
Parameters
Name | Type | Description |
---|---|---|
propertyName | string | Name of the property |
type | Function | Constructor for property type |
options | Object | Property configuration options |
Options Object
Name | Type | Default | Description |
---|---|---|---|
propertyOnly | boolean | false | If true, no attribute created |
Returns
Property configuration object.
Example
Instance Methods
addRenderCallback
Adds a callback to be executed after rendering.
Parameters
Name | Type | Description |
---|---|---|
callback | Function | The callback to be executed |
Example
setDefaultSettings
Sets default settings for a component.
Parameters
Name | Type | Description |
---|---|---|
settings | Object | Default settings values |
componentSpec | Object | Component specification object |
Example
getSettingsFromConfig
Returns current settings including both attributes and properties.
Parameters
Name | Type | Description |
---|---|---|
componentSpec | Object | Component specification object |
properties | Object | Component properties object |
Returns
Current settings object.
Example
createSettingsProxy
Creates a proxy object for reactive settings access.
Parameters
Name | Type | Description |
---|---|---|
componentSpec | Object | Component specification object |
properties | Object | Component properties object |
Returns
A Proxy object for reactive settings.
Example
getUIClasses
Generates CSS classes based on component attributes.
Parameters
Name | Type | Description |
---|---|---|
componentSpec | Object | Component specification object |
properties | Object | Component properties object |
Returns
A string of space-separated CSS classes.
Example
getContent
Retrieves slotted content from a component.
Parameters
Name | Type | Description |
---|---|---|
componentSpec | Object | Component specification object |
Returns
An object containing slotted content.
Example
isDarkMode
Checks if the component is in dark mode.
Returns
Boolean indicating if dark mode is active, or undefined if server-side.
Example
$(selector, options)
Queries the component’s render root.
Parameters
Name | Type | Description |
---|---|---|
selector | string | CSS selector to query |
options | Object | Query configuration |
Options Object
Name | Type | Description |
---|---|---|
root | Element | Root to query from |
Returns
Query result set.
Example
$$(selector)
Queries the original DOM content.
Parameters
Name | Type | Description |
---|---|---|
selector | string | CSS selector to query |
Returns
Query result set.
Example
call
Calls a function with standard parameters.
Parameters
Name | Type | Description |
---|---|---|
func | Function | Function to call |
options | Object | Call configuration options |
Options Object
Name | Type | Default | Description |
---|---|---|---|
firstArg | any | undefined | First argument to pass |
additionalArgs | Array | undefined | Additional arguments |
args | Array | [component, $] | Default arguments |