Skip to main content

Component

The Component class is the base class for all custom UI elements in Windows 93.

Usage

import { Component } from "/42/api/gui/Component.js"

Creating a component

class MyComponent extends Component {
static plan = {
tag: "ui-my-component",
props: {
label: true,
},
content: "Hello!",
}
}

Component.define(MyComponent)

Static properties

PropertyTypeDescription
planPlanDefault plan for the component
observedAttributesString[]Attributes to watch for changes

Instance methods

  • render(plan) - re-render the component with a new plan
  • connectedCallback() - called when added to the DOM
  • disconnectedCallback() - called when removed from the DOM
  • attributeChangedCallback(name, oldVal, newVal) - called when an observed attribute changes

Registration

Use Component.define(MyComponent) to register a custom element.
The tag name is auto-generated from the class name (e.g. MyComponent becomes ui-my-component).