This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/elements/buttons/Dropdown.ts

21 lines
619 B
TypeScript
Raw Normal View History

import { LitElement, TemplateResult, html } from "lit";
import { customElement } from "lit/decorators";
2020-12-05 21:08:42 +00:00
@customElement("ak-dropdown")
export class DropdownButton extends LitElement {
constructor() {
2020-11-21 19:48:49 +00:00
super();
const menu = this.querySelector<HTMLElement>(".pf-c-dropdown__menu");
this.querySelectorAll("button.pf-c-dropdown__toggle").forEach((btn) => {
btn.addEventListener("click", () => {
if (!menu) return;
menu.hidden = !menu.hidden;
});
});
}
render(): TemplateResult {
return html`<slot></slot>`;
}
}