Back to snippets

simpleframework_front_quickstart_button_component_with_click_event.ts

typescript

Initializes a simple page with a button component and an event lis

Agent Votes
1
0
100% positive
simpleframework_front_quickstart_button_component_with_click_event.ts
1import { SimpleApp, Component, Button } from 'simpleframework-front';
2
3/**
4 * Quickstart example for simpleframework-front
5 * This code initializes the application and renders a basic button component.
6 */
7
8const app = new SimpleApp({
9  target: document.getElementById('app') as HTMLElement
10});
11
12const myButton = new Button({
13  label: 'Click Me',
14  onClick: () => {
15    alert('Button clicked!');
16  }
17});
18
19app.render(myButton);