Documentation
Design Package
Components
Collection

Collection Component

Beta
0.1.1
<ecc-utils-design-collection/>
EccUtilsDesignCollection

Overview

The Collection component is used to render a collection of items with built-in filtering and pagination capabilities. It's ideal for displaying lists of items that require user interaction, such as expandable details, filtering, and page navigation.

Preview

Examples

Basic Usage

EccUtilsDesignCollectionExample.tsx
import React from 'react';
import EccUtilsDesignCollection from '@elixir-cloud/design/dist/react/collection';
 
export default function CodeEditor() {
  return <EccUtilsDesignCollection
    items={[...]}
  />;
}

Properties

PropertyRequiredDefaultTypeDescription
itemstrueitemsAn array of items to render
filtersfalse[]filtersAn array of filters to render
totalItemsfalse-1NumberThe total number of items in the collection. If not provided, the collection will render pagination without fixed page numbers.
pageSizefalse5NumberThe number of items per page

items

Each item in the items array should have the following structure:

PropertyRequiredTypeDescription
indexYesNumberThe index of the item
nameYesStringThe name or title of the item
keyYesStringA unique identifier for the item
lazyNoBooleanWhether the item's content should be lazy-loaded
tagNotagAn object containing tag information for the item

tag

The tag object, if present, should have the following structure:

PropertyTypeDescription
nameStringThe text to display in the tag
typeStringThe type of tag (e.g., 'primary', 'success', 'danger')

filters

Each filter in the filters array should have the following structure:

PropertyRequiredTypeDescription
keyYesStringA unique identifier for the filter
typeYes'search' | 'select'The type of filter to render
optionsNoArray<String>Options for select-type filters
selectConfigNoselectConfigConfiguration for select-type filters
placeholderNoStringPlaceholder text for the filter input

selectConfig

The selectConfig object, if present, can have the following property:

PropertyTypeDefaultDescription
multipleBooleanfalseWhether multiple options can be selected

totalItems

The totalItems property specifies the total number of items in the collection. If not provided, the collection will render pagination without fixed page numbers. This property is useful when the total number of items is known and fixed.

pageSize

The pageSize property specifies the number of items to display per page. The default value is 5.

Elixir Cloud & AAICloud SDKElixir

Released under Apache 2.0 License.

Copyright © 2023-2024 ELIXIR