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-card

v0.2.352-4

Published

## Giới thiệu

Readme

Card

Giới thiệu

card là một component Card linh hoạt dành cho Angular, cho phép hiển thị nội dung với phần header tùy chỉnh và body có thể mở rộng hoặc thu gọn (collapse/expand).

Tính năng

  • Hiển thị tiêu đề với text hoặc custom TemplateRef
  • Ẩn/hiện nội dung (collapse/expand) với nút điều khiển
  • Cung cấp sự kiện outChangeStateShowContent khi thay đổi trạng thái hiển thị
  • Cung cấp sự kiện outFunctionsControl để điều khiển từ bên ngoài qua IFunctionControlCard
  • Tùy chỉnh cấu hình giao diện qua IConfigCard (padding, border, background, icon)
  • Tùy thêm CSS cho header và body qua các input
  • Hỗ trợ nội dung linh hoạt bên trong qua <ng-content>

Cài đặt

Yêu cầu

  • Angular 18.0.0 trở lên
  • Tailwind CSS 3.3.0 trở lên

Hướng dẫn

Để cài đặt thư viện card, sử dụng npm hoặc yarn:

npm install @libs-ui/components-card

hoặc

yarn add @libs-ui/components-card

Sử dụng

Cách 1: Inline template

import { Component } from '@angular/core';
import { LibsUiComponentsCardComponent } from '@libs-ui/components-card';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [LibsUiComponentsCardComponent],
  template: `
    <libs_ui-components-card
      [label]="{ labelLeft: 'Tiêu đề Card', popover: {} }"
      [hasCollapseBtn]="true"
      [configCard]="{ width: '300px' }">
      Nội dung ví dụ bên trong Card.
    </libs_ui-components-card>
  `,
})
export class ExampleComponent {}

Cách 2: Sử dụng file HTML riêng biệt

<!-- example.component.html -->
<libs_ui-components-card
  [label]="{ labelLeft: 'Tiêu đề Card', popover: {} }"
  [ignoreTitle]="false"
  [hasCollapseBtn]="true"
  [clickExactly]="false"
  [configCard]="{ ignoreBorderHeader: true }">
  Nội dung Card tùy chỉnh.
</libs_ui-components-card>
// example.component.ts
import { Component } from '@angular/core';
import { LibsUiComponentsCardComponent } from '@libs-ui/components-card';

@Component({
  selector: 'app-example',
  standalone: true,
  imports: [LibsUiComponentsCardComponent],
  templateUrl: './example.component.html',
})
export class ExampleComponent {}

Công nghệ sử dụng

  • Angular 18: standalone components, signals, control flow (@if, @for)
  • Tailwind CSS: xây dựng giao diện demo và tiện ích style

API Reference

Inputs

| Tên | Kiểu dữ liệu | Mặc định | Mô tả | | ------------------------------------- | -------------------------------- | -------- | ----------------------------------------------------------- | | label | ILabel | - | Cấu hình label tiêu đề (text bên trái, popover, v.v.) | | ignoreTitle | boolean | - | Nếu true, ẩn phần header | | hasCollapseBtn | boolean | - | Hiển thị nút collapse/expand | | clickExactly | boolean | - | Chỉ cho phép collapse khi click đúng biểu tượng | | configCard | IConfigCard | - | Cấu hình giao diện card (padding, border, background, icon) | | templateHeader | TemplateRef<TYPE_TEMPLATE_REF> | - | Template custom cho header | | classIncludeBody | string | - | CSS class thêm cho phần body | | classIncludeHeader | string | - | CSS class thêm cho phần header | | classIncludeHeaderWhenHiddenContent | string | - | CSS class khi header ở trạng thái ẩn nội dung |

Outputs

| Tên | Kiểu dữ liệu | Mô tả | | --------------------------- | ---------------------- | ----------------------------------------------------- | | outChangeStateShowContent | boolean | Sự kiện emit khi trạng thái ẩn/hiện nội dung thay đổi | | outFunctionsControl | IFunctionControlCard | Sự kiện cung cấp function control từ bên ngoài |

Interfaces

IConfigCard

export interface IConfigCard {
  ignorePaddingLeft?: boolean;
  ignoreBorderHeader?: boolean;
  ignoreBackgroundHeader?: boolean;
  iconConRight?: boolean;
  width?: string;
  classIncludeLabel?: string;
  classIconInclude?: string;
  classIconWhenShowContent?: string;
  classIconWhenHiddenContent?: string;
  ignoreBorderRadiusHeader?: boolean;
  ignoreBorderBody?: boolean;
}

Mô tả: Cấu hình các thuộc tính hiển thị của Card.

IFunctionControlCard

export interface IFunctionControlCard {
  changeHidden: () => Promise<void>;
}

Mô tả: Interface cho phép điều khiển trạng thái hiển thị (collapse/expand) từ bên ngoài.