🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@libs-ui/components-buttons-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
366
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libs-ui/components-buttons-dropdown

## Giới thiệu

latest
npmnpm
Version
0.2.346-6
Version published
Maintainers
1
Created
Source

Button Dropdown

Giới thiệu

@libs-ui/components-buttons-dropdown là một component Dropdown Button dùng cho Angular, cho phép hiển thị danh sách các tùy chọn khi nhấn vào button, hỗ trợ custom templates, binding lựa chọn và nhiều tùy chỉnh linh hoạt.

Tính năng

  • Hiển thị danh sách items dưới dạng popover khi click (hoặc hover)
  • Hỗ trợ custom label và key cho items
  • Two-way binding giá trị chọn (keySelected)
  • Tuỳ chọn auto apply (applyNow) hoặc yêu cầu click nút Áp dụng
  • Hỗ trợ vô hiệu hóa và tuỳ chỉnh kích thước, kiểu button
  • Cấu hình popover (kích thước, vị trí, z-index, direction)
  • Hỗ trợ custom CSS classes cho container và items

Cài đặt

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

hoặc

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

Sử dụng

Inline Template

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

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [LibsUiComponentsButtonsDropdownComponent],
  template: `
    <libs_ui-components-buttons-dropdown
      [label]="'Chọn mục'"
      [items]="items"
      [(keySelected)]="selectedKey"
      (outSelectItem)="onSelect($event)"></libs_ui-components-buttons-dropdown>
  `,
})
export class ExampleComponent {
  items = [
    { id: '1', label: 'Option 1' },
    { id: '2', label: 'Option 2' },
    { id: '3', label: 'Option 3' },
  ];
  selectedKey = '1';
  onSelect(item: any) {
    console.log('Selected:', item);
  }
}

File HTML riêng

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

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [LibsUiComponentsButtonsDropdownComponent],
  templateUrl: './example.component.html',
})
export class ExampleComponent {
  items = [
    /* ... */
  ];
  selectedKey = '';
  onSelect(item: any) {}
}
<libs_ui-components-buttons-dropdown
  [label]="'Chọn mục'"
  [items]="items"
  [(keySelected)]="selectedKey"
  (outSelectItem)="onSelect($event)"></libs_ui-components-buttons-dropdown>

API Reference

Inputs

TênKiểuMặc địnhMô tả
labelstring''Text hiển thị trên nút (ví dụ: "Chọn mục").
itemsArray<any>requiredDanh sách các mục sẽ hiển thị trong menu.
fieldDisplaystringlabelTrường của mục để hiển thị nội dung.
keyFieldstringidTrường của mục dùng làm giá trị key.
keySelectedstringundefinedGiá trị key đang được chọn (hỗ trợ two-way binding).
applyNowbooleanfalseNếu true: chọn xong tự emit sự kiện; false: cần bấm nút Áp dụng.
showBorderBottombooleanfalseHiện đường kẻ dưới menu khi mở.
disablebooleanfalseKhóa dropdown, không cho chọn mục.
sizeButtonTYPE_SIZE_BUTTONmediumKích thước nút (.small/.medium/.large).
typeButtonTYPE_BUTTONbutton-primaryKiểu style của nút (primary, secondary,...).
classLabelstring''Class CSS thêm cho nhãn (text).
classIncludestring''Class CSS thêm cho phần container chính.
classIncludeContainerstringundefinedClass CSS thêm cho phần container nội dung.
fieldClassstringclassTrường trong mục chứa class CSS khi cần.
classIconLeftstring''Class CSS thêm cho icon bên trái.
classIconRightstringlibs-ui-icon-move-right rotate-[90deg]Class CSS thêm cho icon bên phải.
iconOnlyTypebooleanfalseChỉ hiện icon, không hiển thị nhãn.
popupConfigIPopupConfigButtonDropdowndefault cấu hình popoverCấu hình chi tiết cho popover (vị trí, kích thước).
ignoreHiddenPopoverContentWhenMouseLeavebooleantrueGiữ popover mở khi chuột rời khỏi nội dung.
modePopoverTYPE_POPOVER_MODEclick-toggleCách hiển thị popover (click, hover,...).

Outputs

TênKiểuMô tả
outSelectItem(item: any) => voidTrả về mục (item) bạn vừa chọn.
outHover(isHover: boolean) => voidPhát ra khi rê chuột lên/xuống trên một mục.
outApply(item: any) => voidPhát ra khi bạn bấm nút Áp dụng (với applyNow=false).
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 control API để điều khiển popover.
outIconEvent(event: MouseEvent) => voidPhát ra khi bạn nhấn vào icon.

Interfaces

export interface IButtonDropdown extends IButton {
  items: any[];
  fieldDisplay?: string;
  keyField?: string;
  keySelected?: string;
  applyNow?: boolean;
  showBorderBottom?: boolean;
  popupConfig?: IPopupConfigButtonDropdown;
  ignoreHiddenPopoverContentWhenMouseLeave?: boolean;
  modePopover?: TYPE_POPOVER_MODE;
}

export interface IPopupConfigButtonDropdown {
  width?: number;
  maxWidth?: number;
  maxHeight?: number;
  zIndex?: number;
  direction?: TYPE_POPOVER_DIRECTION;
  timeDestroy?: number;
  widthByParent?: boolean;
  position?: {
    mode: 'start' | 'center' | 'end';
    distance: number;
  };
  classInclude?: string;
}

export type TYPE_POPOVER_DIRECTION = 'top' | 'right' | 'bottom' | 'left';
export type TYPE_POPOVER_MODE = 'hover' | 'click' | 'click-toggle' | 'click_open_and_click_panel_content_hidden';

FAQs

Package last updated on 04 Dec 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