@skhemata/skhemata-form
Version:
Skhemata Form Web Component. This web component can be used as base web component when working with forms and inputs.
48 lines (38 loc) • 1.19 kB
text/typescript
import { html, css, CSSResult, SkhemataBase, property } from '@skhemata/skhemata-base';
export class SkhemataFormButton extends SkhemataBase {
static get stlyes() {
return <CSSResult[]>[
...super.styles,
css`
.field {
margin-bottom: 1rem;
display: block;
}
`,
];
}
title = '';
type = '';
isFullwidth = false;
isLoading = false;
valid = true;
helpClass = '';
handleClick() {
if (this.type === 'submit') {
this.dispatchEvent(new CustomEvent('submit'));
} else {
this.dispatchEvent(new Event('click'));
}
}
render() {
return html`
<button
class="button ${this.isFullwidth ? 'is-fullwidth' : '' } is-primary ${this.isLoading ? 'is-loading' : ''}"
style="background-color: var(--skhemata-form-button-background-color, #00d1b2); color: var(--skhemata-form-button-text-color, #fff);"
=${this.handleClick}
>
${this.title}
</button>
`;
}
}