File

src/components/sq-tabs/sq-tab/sq-tab.component.ts

Description

Represents a tab component for displaying tabbed content.

Look the link about the component in original framework and the appearance

See https://css.squidit.com.br/components/tabs

Example :
<sq-tab [title]="'Tab Title'" (whenOpen)="handleTabOpen()">
<!-- Content Here -->
</sq-tab>

Metadata

Index

Properties
Inputs
Outputs
Accessors

Constructor

constructor(cdr: ChangeDetectorRef)

Creates an instance of SqTabComponent.

Parameters :
Name Type Optional Description
cdr ChangeDetectorRef No
  • Angular's ChangeDetectorRef for manual change detection control.

Inputs

active
Type : boolean

Sets or gets the active state of the tab. If set to true, triggers change detection.

borderColor
Type : string
Default value : 'transparent'

The border color of the tab.

color
Type : string
Default value : 'white'

The background color of the tab.

disabled
Type : boolean

Flag to indicate if the tab is disabled.

hideHtml
Type : boolean

Sets or gets whether the tab HTML should be hidden. Triggers change detection when updated.

loading
Type : boolean

Flag to indicate if the tab is in a loading state.

tabName
Type : string
Default value : ''

The name or identifier of the tab.

textColor
Type : string
Default value : 'black'

The text color of the tab title.

title
Type : string
Default value : ''

The title displayed on the tab.

Outputs

whenOpen
Type : EventEmitter<void>

Event emitted when the tab is opened.

Properties

Private _active
Default value : false

Internal property to track the active state of the tab.

Private _hideHtml
Default value : false

Internal property to track if the tab HTML should be hidden.

Accessors

active
getactive()
setactive(value: boolean)

Sets or gets the active state of the tab. If set to true, triggers change detection.

Parameters :
Name Type Optional
value boolean No
Returns : void
hideHtml
gethideHtml()
sethideHtml(value: boolean)

Sets or gets whether the tab HTML should be hidden. Triggers change detection when updated.

Parameters :
Name Type Optional
value boolean No
Returns : void
import { ChangeDetectorRef } from '@angular/core';
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';

/**
 * Represents a tab component for displaying tabbed content.
 *
 * Look the link about the component in original framework and the appearance
 *
 * @see {@link https://css.squidit.com.br/components/tabs}
 *
 * @example
 * <sq-tab [title]="'Tab Title'" (whenOpen)="handleTabOpen()">
 * <!-- Content Here -->
 * </sq-tab>
 */
@Component({
  selector: 'sq-tab',
  templateUrl: './sq-tab.component.html',
  styleUrls: ['./sq-tab.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
  standalone: true,
})
export class SqTabComponent {
  /**
   * Internal property to track the active state of the tab.
   */
  private _active = false;

  /**
   * Sets or gets the active state of the tab.
   * If set to `true`, triggers change detection.
   */
  @Input() set active(value: boolean) {
    this._active = value;
    if (value) {
      this.cdr.markForCheck();
    }
  }
  get active(): boolean {
    return this._active;
  }

  /**
   * The title displayed on the tab.
   */
  @Input() title = '';

  /**
   * The text color of the tab title.
   */
  @Input() textColor = 'black';

  /**
   * The background color of the tab.
   */
  @Input() color = 'white';

  /**
   * The border color of the tab.
   */
  @Input() borderColor = 'transparent';

  /**
   * Flag to indicate if the tab is disabled.
   */
  @Input() disabled?: boolean;

  /**
   * Flag to indicate if the tab is in a loading state.
   */
  @Input() loading?: boolean;

  /**
   * The name or identifier of the tab.
   */
  @Input() tabName = '';

  /**
   * Internal property to track if the tab HTML should be hidden.
   */
  private _hideHtml = false;

  /**
   * Sets or gets whether the tab HTML should be hidden.
   * Triggers change detection when updated.
   */
  @Input() set hideHtml(value: boolean) {
    this._hideHtml = value;
    this.cdr.markForCheck();
  }
  get hideHtml(): boolean {
    return this._hideHtml;
  }

  /**
   * Event emitted when the tab is opened.
   */
  @Output() whenOpen: EventEmitter<void> = new EventEmitter();

  /**
   * Creates an instance of SqTabComponent.
   * @param cdr - Angular's ChangeDetectorRef for manual change detection control.
   */
  constructor(private cdr: ChangeDetectorRef) {}
}
@if (!hideHtml) {
  <div [hidden]="!active" class="pane">
    <ng-content></ng-content>
  </div>
}

./sq-tab.component.scss

:host {
  .pane {
    padding: 0;
  }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""