Built-in Properties

Every component has built-in properties that are used for its functionality and configuration.

Static Properties

These properties are defined on the component class itself.

tag

The HTML tag name for the component. Required.

class MyComponent extends Monogatari.Component {
    // ...
}
MyComponent.tag = 'my-component';

This defines how the component is used in HTML:

<my-component></my-component>

_configuration

Configuration object for the component. Each component should declare its own to avoid sharing state:

class MyComponent extends Monogatari.Component {
    static _configuration = {
        defaultValue: 'something',
        options: {}
    };
}

_experimental

Marks the component as experimental (not stable for production):

_priority

Determines the order in which components are initialized:

engine

Reference to the Monogatari engine (set automatically on registration):

Instance Properties

These properties are available on each component instance.

props

Component properties passed from outside:

state

Internal component state:

engine

Instance-level reference to the Monogatari engine:

_parent

Reference to the parent component (if any):

Props vs State

Feature
Props
State

Source

External (from parent or engine)

Internal (component itself)

Mutability

Should not be changed by component

Can be changed by component

Update callback

onPropsUpdate()

onStateUpdate()

Usage

Configuration, data from outside

UI state, internal data

Example

Accessing Properties

From Static Methods

From Instance Methods

Last updated

Was this helpful?