You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@libs-ui/components-buttons-button

Package Overview
Dependencies
Maintainers
0
Versions
293
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libs-ui/components-buttons-button

## Giới thiệu

0.2.304
latest
npmnpm
Version published
Weekly downloads
1.4K
37.44%
Maintainers
0
Weekly downloads
 
Created
Source

Button

Giới thiệu

@libs-ui/components-buttons-button là một component Button linh hoạt dùng cho ứng dụng Angular. Component này hỗ trợ:

  • Nhiều kiểu button (primary, secondary, third, outline, outline-green, link, custom)
  • Nhiều kích thước (large, medium, small, smaller)
  • Trạng thái loading (pending) và disabled
  • Hiển thị popover thông tin khi hover hoặc focus
  • Xuất ra các sự kiện click và popover control

Tính năng

  • Tùy chọn kiểu hiển thị: button-primary, button-secondary, button-third, button-outline, button-outline-green, button-link, button-custom
  • Tùy chọn kích thước: large | medium | small | smaller
  • Trạng thái loading dễ dàng với isPending
  • Vô hiệu hóa button với disable
  • Hỗ trợ popover nội dung tùy chỉnh

Cài đặt

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

hoặc

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

Sử dụng

Inline Template

import { Component } from '@angular/core';
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [LibsUiComponentsButtonsButtonComponent],
  template: `
    <libs_ui-components-buttons-button
      [type]="'button-primary'"
      [label]="'Click me'"
      (outClick)="onClick()">
    </libs_ui-components-buttons-button>
  `
})
export class ExampleComponent {
  onClick() {
    console.log('Clicked');
  }
}

File HTML riêng

import { Component } from '@angular/core';
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [LibsUiComponentsButtonsButtonComponent],
  templateUrl: './example.component.html'
})
export class ExampleComponent {}
<libs_ui-components-buttons-button
  [type]="'button-secondary'"
  [label]="'Submit'">
</libs_ui-components-buttons-button>

Công nghệ sử dụng

  • Angular 18 với standalone components và Signals
  • Tailwind CSS 3.x (phong cách demo)

API Reference

Inputs

TênKiểuMặc địnhMô tả
typeTYPE_BUTTONbutton-primaryKiểu style của nút (ví dụ: button-primary, button-secondary, ...).
sizeButtonTYPE_SIZE_BUTTONmediumKích thước của nút (large, medium, small, smaller).
labelstring' 'Nội dung text hiển thị trên nút.
disablebooleanfalseNếu true: vô hiệu hóa nút, không cho tương tác.
isPendingbooleanfalseNếu true: hiển thị trạng thái loading và vô hiệu hóa nút.
popoverIPopover{}Cấu hình chi tiết cho popover (nội dung, vị trí, chế độ hiển thị).
buttonCustomIColorButtonundefinedCấu hình màu custom khi type là button-custom hoặc button-link-custom.
imageLeft{ src: string; classInclude?: string }undefinedThêm image/icon bên trái nút.
classIncludestring''Class CSS thêm cho container nút.
classIconLeftstring''Class CSS thêm cho icon bên trái.
classIconRightstring''Class CSS thêm cho icon bên phải.
classLabelstring''Class CSS thêm cho nhãn (label).
iconOnlyTypebooleanfalseChỉ hiển thị icon, không hiển thị nhãn.
ignoreStopPropagationEventbooleantrueCho phép ngăn chặn hoặc không propagation sự kiện click.
zIndexnumber10Giá trị z-index của popover.
widthLabelPopovernumberundefinedChiều rộng của label popover (px).
styleIconLeftRecord<string, any>undefinedStyle inline cho icon trái.
styleButtonRecord<string, any>undefinedStyle inline cho button.
ignoreFocusWhenInputTabbooleanundefinedBỏ qua focus khi nhấn Tab.
ignoreSetClickWhenShowPopoverbooleanundefinedBỏ qua set click khi show popover.
ignorePointerEventbooleanundefinedBỏ qua pointer events.
isActivebooleanundefinedTrạng thái active của button.
isHandlerEnterDocumentClickButtonbooleanundefinedCho phép xử lý event Enter trên document.

Outputs

TênKiểuMô tả
outClick(event: Event) => voidPhát ra khi người dùng click vào nút.
outPopoverEvent(event: TYPE_POPOVER_EVENT) => voidPhát ra các sự kiện của popover (show, hide, click).
outFunctionsControl(control: IPopoverFunctionControlEvent) => voidCung cấp API để điều khiển popover.

Interfaces

TYPE_BUTTON

export type TYPE_BUTTON =
  'button-primary'
  | 'button-primary-revert'
  | 'button-secondary'
  | 'button-secondary-red'
  | 'button-outline-secondary'
  | 'button-third'
  | 'button-outline'
  | 'button-danger-high'
  | 'button-outline-hover-danger'
  | 'button-third-hover-danger'
  | 'button-danger-low'
  | 'button-green'
  | 'button-violet'
  | 'button-secondary-green'
  | 'button-outline-green'
  | 'button-custom'
  | 'button-link-primary'
  | 'button-link-third'
  | 'button-link-danger-high'
  | 'button-link-danger-low'
  | 'button-link-green'
  | 'button-link-violet'
  | 'button-link-custom'
  | string;

Mô tả: Các giá trị style của nút được hỗ trợ.

TYPE_SIZE_BUTTON

export type TYPE_SIZE_BUTTON = 'large' | 'medium' | 'small' | 'smaller';

Mô tả: Các giá trị kích thước của nút được hỗ trợ.

IPopover

export interface IPopover {
  type?: TYPE_POPOVER_TYPE;
  mode?: TYPE_POPOVER_MODE;
  dataView?: string;
  config?: IPopoverOverlay;
  classInclude?: string;
  ignoreShowPopover?: boolean;
}

Mô tả: Cấu hình chi tiết cho popover (nội dung, vị trí, chế độ hiển thị).

FAQs

Package last updated on 25 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts