@deepkit/desktop-ui
Version:
Library for desktop UI widgets in Angular 10+
48 lines (42 loc) • 1.33 kB
text/typescript
/*
* Deepkit Framework
* Copyright (C) 2021 Deepkit UG, Marc J. Schmidt
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* You should have received a copy of the MIT License along with this program.
*/
import { Component, HostListener, Input } from '@angular/core';
import { ngValueAccessor, ValueAccessorBase } from '../../core/form';
export class TabButtonComponent extends ValueAccessorBase<any> {
/**
* Whether the button is active (pressed).
*
* Use alternatively form API, e.g. <dui-tab-button [(ngModel)]="chosen" value="overview"></dui-tab-button>
*/
active: boolean | '' = false;
value?: any;
onClick() {
if (this.value === undefined) return;
this.innerValue = this.value;
}
isActive(): boolean {
if (this.value !== undefined) return this.value === this.innerValue;
return this.active !== false
}
}