diff --git a/src/button/Button.stories.ts b/src/button/Button.stories.ts
index e70f8cb..b663ced 100644
--- a/src/button/Button.stories.ts
+++ b/src/button/Button.stories.ts
@@ -9,7 +9,6 @@ export default meta;
export const Template: StoryObj = {
args: {
- children: "Button",
intent: "primary",
disabled: false,
},
@@ -21,6 +20,25 @@ export const Template: StoryObj = {
},
},
},
- render: (args) =>
- html`${args.children}`,
+ render: (args) => {
+ let buttonRendered = false;
+ const handleClick = () => {
+ // Function required as the click event is triggered once on render
+ if (buttonRendered) {
+ alert("Button Clicked");
+ return;
+ }
+ buttonRendered = true;
+ };
+
+ return html`
+
+ Button
+
+ `;
+ },
};
diff --git a/src/button/Button.ts b/src/button/Button.ts
index fd68a98..b504932 100644
--- a/src/button/Button.ts
+++ b/src/button/Button.ts
@@ -51,4 +51,8 @@ export class button extends LitElement {
`;
}
+
+ updated(changedProperties) {
+ this.dispatchEvent(new Event("click"));
+ }
}