
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@libs-ui/components-buttons-select-color
Advanced tools
select-color là một component nút kết hợp bộ chọn màu (Color Picker) cho Angular. Cho phép người dùng chọn màu sắc từ popover, hỗ trợ cấu hình tùy chỉnh, áp dụng ngay hoặc chờ xác nhận, và tùy chỉnh hiển thị nút.
customOptions cho Color PickerapplyNow: tự động emit khi chọn màu nếu trueexternalContent: sử dụng nội dung bên ngoài làm triggerdirection và zIndex của popoveroutColorChange và outColorChangeMultipleType khi màu thay đổiĐể cài đặt component select-color, sử dụng npm hoặc yarn:
npm install @libs-ui/components-buttons-select-color
hoặc
yarn add @libs-ui/components-buttons-select-color
import { Component } from '@angular/core';
import { LibsUiComponentsButtonsSelectColorComponent } from '@libs-ui/components-buttons-select-color';
@Component({
selector: 'app-example',
standalone: true,
imports: [LibsUiComponentsButtonsSelectColorComponent],
template: `
<libs_ui-components-buttons-select_color
[button]="{ label: 'Chọn màu', type: 'button-primary' }"
[customOptions]="{ /* cấu hình picker */ }"
[applyNow]="false"
(outColorChange)="onColorChange($event)"></libs_ui-components-buttons-select_color>
`,
})
export class ExampleComponent {
onColorChange(color: string) {
console.log('Màu đã chọn:', color);
}
}
<!-- example.component.html -->
<libs_ui-components-buttons-select_color
[button]="{ label: 'Chọn màu', classIconLeft: 'text-red-500', type: 'button-outline' }"
[direction]="'top'"
[externalContent]="false"
[zIndex]="1500"
(outColorChangeMultipleType)="onMultiColorChange($event)"></libs_ui-components-buttons-select_color>
// example.component.ts
import { Component } from '@angular/core';
import { LibsUiComponentsButtonsSelectColorComponent } from '@libs-ui/components-buttons-select-color';
@Component({
selector: 'app-example',
standalone: true,
imports: [LibsUiComponentsButtonsSelectColorComponent],
templateUrl: './example.component.html',
})
export class ExampleComponent {}
| Tên | Kiểu dữ liệu | Mặc định | Mô tả |
|---|---|---|---|
| button | IButton | - | Cấu hình trigger button (label, icon, class, popover, ...). |
| customOptions | IPickerCustomOptions | - | Tùy chọn cấu hình cho Color Picker. |
| applyNow | boolean | false | Nếu true, emit outColorChange ngay khi chọn màu. |
| externalContent | boolean | false | Sử dụng nội dung bên ngoài làm trigger. |
| direction | TYPE_POPOVER_DIRECTION | 'bottom' | Hướng hiển thị của popover. |
| zIndex | number | 1200 | Z-index của popover. |
| Tên | Kiểu dữ liệu | Mô tả |
|---|---|---|
| outColorChange | string | Sự kiện emit màu khi chọn (dạng hex). |
| outColorChangeMultipleType | IOutputColorChangeMultipleType | Sự kiện emit nhiều định dạng màu khác nhau. |
export interface IPickerCustomOptions {
slBarSize?: number[];
hueBarSize?: number[];
alphaBarSize?: number[];
showHsl?: boolean;
showRgb?: boolean;
showHex?: boolean;
showAlpha?: boolean;
color?: string | number[];
format?: 'rgb' | 'rgba' | 'hsl' | 'hsla' | 'hex' | 'color';
}
Mô tả: Tùy chọn cấu hình cho Color Picker.
export interface IOutputColorChangeMultipleType {
rgba: string;
rgb: string;
hex: string;
hsl: string;
hsla: string;
}
Mô tả: Đối tượng chứa nhiều định dạng giá trị màu khi chọn.
FAQs
Did you know?

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.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.