npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@libs-ui/components-buttons-tab

v0.2.352-4

Published

## Giới thiệu

Readme

Button Tab

Giới thiệu

@libs-ui/components-buttons-tab là một component Tab cho Angular, cho phép hiển thị danh sách tabs, hỗ trợ trạng thái active và tuỳ chỉnh màu cho type "other".

Tính năng

  • Hiển thị tabs dạng button theo danh sách đầu vào
  • Two-way binding cho tab đang active (keySelected)
  • Hỗ trợ vô hiệu hóa toàn bộ tabs (disable)
  • Type other cho phép cấu hình màu chữ và nền riêng (otherConfig)
  • Hỗ trợ hiển thị số lượng badge (count, maxCount, modeCount)

Cài đặt

npm install @libs-ui/components-buttons-tab

hoặc

yarn add @libs-ui/components-buttons-tab

Sử dụng

Inline Template

import { Component } from '@angular/core';
import { LibsUiComponentsButtonsTabComponent, IButtonTab, IOtherConfig } from '@libs-ui/components-buttons-tab';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [LibsUiComponentsButtonsTabComponent],
  template: `
    <libs_ui-components-buttons-tab
      [items]="tabs"
      [disable]="isDisabled"
      [(keySelected)]="selectedKey"
      [otherConfig]="otherConfig"
      (outKeySelected)="onSelect($event)"></libs_ui-components-buttons-tab>
  `,
})
export class ExampleComponent {
  tabs: IButtonTab[] = [
    { key: 'tab1', label: 'Tab 1', type: 'blue' },
    { key: 'tab2', label: 'Tab 2', type: 'red', count: 5 },
    { key: 'tab3', label: 'Tab 3', type: 'other' },
  ];
  isDisabled = false;
  selectedKey = 'tab1';
  otherConfig: IOtherConfig = { color: '#000000', background: '#ffffff' };

  onSelect(key: string) {
    console.log('Selected tab:', key);
  }
}

File HTML riêng

import { Component } from '@angular/core';
import { LibsUiComponentsButtonsTabComponent, IButtonTab, IOtherConfig } from '@libs-ui/components-buttons-tab';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [LibsUiComponentsButtonsTabComponent],
  templateUrl: './example.component.html',
})
export class ExampleComponent {
  tabs: IButtonTab[] = [
    /* ... */
  ];
  isDisabled = false;
  selectedKey = '';
  otherConfig: IOtherConfig = { color: '#000000', background: '#ffffff' };

  onSelect(key: string) {}
}
<libs_ui-components-buttons-tab
  [items]="tabs"
  [disable]="isDisabled"
  [(keySelected)]="selectedKey"
  [otherConfig]="otherConfig"
  (outKeySelected)="onSelect($event)"></libs_ui-components-buttons-tab>

Công nghệ sử dụng

  • Angular 18 standalone components, Signals
  • Tailwind CSS 3.x

API Reference

Inputs

| Tên | Kiểu | Mặc định | Mô tả | | ----------- | ------------------- | -------- | --------------------------------- | | items | Array<IButtonTab> | required | Danh sách cấu hình tabs | | disable | boolean | false | Vô hiệu hóa toàn bộ tabs | | keySelected | string | '' | Key của tab đang active (two-way) | | otherConfig | IOtherConfig | n/a | Cấu hình màu cho type 'other' |

Outputs

| Tên | Kiểu | Mô tả | | -------------- | -------- | -------------------------- | | outKeySelected | string | Emit key của tab được chọn |

Interfaces

IButtonTab

| Property | Type | Required | Description | | ---------- | ----------------- | -------- | ---------------------------------------------------------------------- | | key | string | yes | Định danh duy nhất của tab, dùng cho two-way binding. | | label | string | yes | Nội dung text hiển thị trên tab. | | type | TYPE_BUTTON_TAB | yes | Chủ đề màu của tab; giá trị mặc định hoặc tuỳ chỉnh qua otherConfig. | | count | number | no | Giá trị số (badge) hiển thị trên tab. | | modeCount | TYPE_BADGE_MODE | no | Chế độ hiển thị badge khi count vượt quá maxCount. | | maxCount | number | no | Số tối đa hiển thị trước khi chuyển sang định dạng modeCount. | | class | string | no | Các class CSS thêm cho container tab. | | classLabel | string | no | Các class CSS thêm cho label text. | | disable | boolean | no | Nếu true: vô hiệu hoá tương tác click cho tab này. | | data | any | no | Dữ liệu tuỳ ý gắn kèm với tab. |

IOtherConfig

| Property | Type | Required | Description | | ---------------- | -------- | -------- | ---------------------------------------------------------- | | color | string | yes | Màu chữ (label) cho tab đang active khi typeother. | | background | string | no | Màu nền cho tab đang active khi typeother. | | background_badge | string | no | Màu nền cho badge khi typeother. |

TYPE_BUTTON_TAB

| Value | Description | | -------- | -------------------------------------------------------- | | blue | Chủ đề màu xanh mặc định. | | green | Chủ đề màu xanh lá (thành công). | | red | Chủ đề màu đỏ (cảnh báo). | | orange | Chủ đề màu cam (cảnh báo). | | yellow | Chủ đề màu vàng (thông tin). | | cyan | Chủ đề màu xanh lam nhạt (phụ). | | purple | Chủ đề màu tím (nổi bật). | | brown | Chủ đề màu nâu (trung tính). | | other | Chủ đề tuỳ chỉnh; màu được định nghĩa qua otherConfig. | | string | Các tên chủ đề tuỳ chỉnh khác. |