var Component = require("montage/ui/component").Component; // Define a simple custom component var MyComponent = Component.specialize({ // Define properties title: { value: "Hello World" }, message: { value: "This is a greeting from MyComponent!" }, // Define template template: { value: "{{title}}
{{message}}
" } }); // Instantiate and attach to the DOM var myComponent = new MyComponent(); myComponent.attachTo(document.body);
var Component = require("montage/ui/component").Component; // Define a custom button component var MyButton = Component.specialize({ // Define properties title: { value: "Click Me" }, // Define template template: { value: "" }, // Handle click event handleClick: { value: function(event) { console.log("Button clicked!"); } }, // Bind click event to button element prepareForActivationEvents: { value: function() { this.element.addEventListener("click", this); } } }); // Instantiate and attach to the DOM var myButton = new MyButton(); myButton.attachTo(document.body);In this example, we define a custom button component called MyButton that displays a button with a title. We define a click event handler that logs a message to the console and bind it to the button element using the prepareForActivationEvents method. We then instantiate the component and attach it to the DOM. Based on these examples, it appears that the montage.ui.component Component is part of the MontageJS library.