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

flexi-grid

Package Overview
Dependencies
Maintainers
1
Versions
210
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flexi-grid

A lightweight, customizable Angular data grid component with filtering, sorting, and pagination features.

20.0.7
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Flexi Grid

Flexi Grid is an advanced, lightweight, and customizable Angular 20 data grid component. It provides powerful features such as filtering, sorting, resizing, data binding, multi-language support, and both light and dark themes.

This library is designed to be flexible and easy to integrate into any Angular application, offering a seamless user experience with responsive and interactive data tables.

Live Demo

Edit in CodeSandbox

Features

Flexi Grid comes with a variety of powerful features, making it a versatile choice for displaying and managing tabular data in Angular applications.

  • βœ… Filtering: Supports multiple filter types, including text, number, date, and boolean filters.
  • πŸ”„ Sorting: Column-based sorting with ascending and descending options.
  • πŸ“ Resizable Columns: Allows users to adjust column widths dynamically.
  • πŸ”— Data Binding: Works seamlessly with both static and dynamic data sources.
  • 🌍 Multi-language Support: Built-in support for English (en) and Turkish (tr).
  • 🎨 Theme Options: Choose between light and dark modes.
  • πŸ“Š Pagination: Supports configurable page sizes and navigation.
  • πŸ‘€ Column Visibility Control: Toggle column visibility dynamically.
  • πŸ“€ Excel Export: Export table data to an Excel file with a single click.
  • 🎭 Custom Templates: Allows custom header, footer, and cell templates for advanced customization.

Installation

To install Flexi Grid in your Angular 19 project, use the following command:

npm install flexi-grid

Importing the Module

After installation, import Flexi Grid into your Angular module:

import { FlexiGridModule } from 'flexi-grid';

@Component({
    imports: [
    FlexiGridModule
],
    templateUrl: './home.component.html',
    encapsulation: ViewEncapsulation.None,
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class UsersComponent {}

Basic Usage

To use Flexi Grid, add the <flexi-grid> component to your template and bind it to your data.

<flexi-grid [data]="data">
  <flexi-grid-column field="id" title="ID" width="70px" />
  <flexi-grid-column field="name" title="Name" />
  <flexi-grid-column field="email" title="Email" />
  <flexi-grid-column field="salary" title="Salary" filterType="number" format="c" textAlign="right" symbol="$" />
  <flexi-grid-column field="startDate" title="Start Date" filterType="date" format="dd MMM yyyy" />
</flexi-grid>

Component Data Example

In your component file (.ts), define the data array:

export class ExampleComponent {
  data = [
    { id: 1, name: 'John Doe', email: 'john@example.com', salary: 5000, startDate: "2024-01-02" },
    { id: 2, name: 'Jane Smith', email: 'jane@example.com', salary: 6000, startDate: "2024-01-05" },
    { id: 3, name: 'Alice Brown', email: 'alice@example.com', salary: 7000, startDate: "2024-02-03" }
  ];
}

This will render a data grid with columns for ID, Name, Email, and Salary, along with filtering and sorting functionalities.

API Documentation

<flexi-grid> Inputs

InputTypeDefaultDescription
dataany[][]The dataset to be displayed in the grid.
totalnumber | null0Total number of records (useful for server-side pagination).
dataBindbooleanfalseEnables server-side data binding. When true, the grid does not handle filtering, sorting, or pagination on the client-side. Instead, it provides a StateModel object inside the dataStateChange output event, which contains the current grid state (pagination, sorting, and filtering). You need to manually handle API requests in your service using this state object.
pageablebooleantrueEnables or disables pagination.
sortablebooleantrueEnables or disables sorting.
filterablebooleantrueEnables or disables filtering.
themeClass"light" | "dark""light"Sets the theme of the grid.
showIndexbooleanfalseDisplays row index numbers.
showColumnVisibilitybooleantrueEnables column visibility toggling.
showExportExcelBtnbooleanfalseEnables Excel export functionality.
exportExcelFileNamestring"export"Sets the filename for exported Excel files.
widthstring"100%"Defines the width of the grid.
heightstring"500px"Defines the height of the grid.
language"tr" | "en""tr"Sets the language for UI elements.
reorderablebooleanfalseEnables row reordering via drag-and-drop.
selectablebooleanfalseEnables row selection.
sortStateSortModel | undefinedundefinedSets the initial sort configuration. When provided, the grid will apply this sorting on initialization. The object should contain field (column field name) and dir (sort direction: 'asc' or 'desc'). Example: {field: 'name', dir: 'asc'}.
filterStateFilterModel[][]Sets the initial filter configuration. When provided, the grid will apply these filters on initialization. Each filter object should contain field (column field name), value (filter value), operator (filter operator like 'eq', 'contains', etc.), and type (filter type like 'text', 'number', 'date'). Example: [{field: 'name', value: 'John', operator: 'contains', type: 'text'}].

<flexi-grid-column> Inputs

InputTypeDefaultDescription
fieldstring""The field name in the data source.
titlestring""The column title displayed in the header.
sortablebooleantrueEnables sorting for this column.
filterablebooleantrueEnables filtering for this column.
filterType"text" | "number" | "date""text"The type of filter for this column.
widthstring"160px"Sets the column width.
textAlign"left" | "center" | "right""left"Aligns the text in the column.
format"n" | "c" | nullnullNumber formatting, "c" for currency.
symbolstring""Currency symbol for formatted numbers.
visiblebooleantrueControls column visibility.
resizablebooleantrueAllows resizing of the column.
classNamestring""Custom CSS class for styling.

Advanced Usage

You can customize the caption, header, cell, **column command **, and footer of any column using Angular templates.

Custom Caption Command Template

Use flexiGridCaptionCommandTemplate for adding commands to the table caption:

<flexi-grid>
  <ng-template flexiGridCaptionCommandTemplate>
    <flexi-button btnColor="primary" btnIcon="add" btnSize="small" flexiTooltip title="Add" />
  </ng-template>
</flexi-grid>

Custom Cell Template

Use flexiGridCellTemplate to define a custom cell template:

<flexi-grid [data]="data">
  <flexi-grid-column field="name" title="Full Name">
    <ng-template flexiGridCellTemplate let-item>
      <b>{{ item.name }}</b>
    </ng-template>
  </flexi-grid-column>
</flexi-grid>

Custom Header Template

Use flexiGridHeaderTemplate to define a custom header:

<flexi-grid-column field="salary" title="Salary">
  <ng-template flexiGridHeaderTemplate>
    <input type="search" class="form-control" [(ngModel)]="filterSalary" (keyup)="filterSalary()">
  </ng-template>
</flexi-grid-column>

Use flexiGridFooterTemplate for footer customization:

<flexi-grid-column field="salary" title="Salary">
  <ng-template flexiGridFooterTemplate let-data>
    Total: {{ data.reduce((sum, item) => sum + item.salary, 0) | currency }}
  </ng-template>
</flexi-grid-column>

Custom Command Column Template

Use flexiGridColumnCommandTemplate to define a custom command column template:

<flexi-grid>
  <ng-template flexiGridColumnCommandTemplate let-item>
    <flexi-button btnColor="primary" btnIcon="zoom_in" btnSize="small" title="Detail" flexiTooltip/>
    <flexi-button btnColor="warning" btnIcon="edit" btnSize="small" flexiTooltip title="Edit" />
    <flexi-button btnColor="danger"  btnSize="small" (click)="deleteByItem(item)" btnIcon="delete" flexiTooltip title="Delete" />
  </ng-template>
</flexi-grid>

Initial Sort Configuration

You can set an initial sort configuration to have the grid display data in a specific order when it loads:

<flexi-grid 
  [data]="data" 
  [sort]="{field: 'name', dir: 'asc'}">
  
  <flexi-grid-column field="id" title="ID" width="70px" />
  <flexi-grid-column field="name" title="Name" />
  <flexi-grid-column field="email" title="Email" />
  <flexi-grid-column field="salary" title="Salary" filterType="number" />
</flexi-grid>

Initial Filter Configuration

You can set initial filters to have the grid display filtered data when it loads:

<flexi-grid
  [data]="data"
  [filter]="initialFilters">

  <flexi-grid-column field="id" title="ID" width="70px" />
  <flexi-grid-column field="name" title="Name" />
  <flexi-grid-column field="email" title="Email" />
  <flexi-grid-column field="salary" title="Salary" filterType="number" />
  <flexi-grid-column field="department" title="Department" />
</flexi-grid>
export class ExampleComponent {
  data = [
    { id: 1, name: 'John Doe', email: 'john@example.com', salary: 5000, department: 'IT' },
    { id: 2, name: 'Jane Smith', email: 'jane@example.com', salary: 6000, department: 'HR' },
    { id: 3, name: 'Alice Brown', email: 'alice@example.com', salary: 7000, department: 'IT' }
  ];

  initialFilters: StateFilterModel[] = [
    {
      field: 'department',
      value: 'IT',
      operator: 'eq',
      type: 'text'
    },
    {
      field: 'salary',
      value: '5000',
      operator: 'gt',
      type: 'number'
    }
  ];
}

Contributing

We welcome contributions to improve Flexi Grid! If you would like to contribute, please follow these steps:

  • Fork the Repository – Clone your fork locally.
  • Create a Branch – Use a meaningful name, e.g., feature/custom-theme-support.
  • Make Your Changes – Ensure the code follows Angular best practices.
  • Commit and Push – Write clear commit messages.
  • Create a Pull Request – Submit your changes for review.

Reporting Issues

If you find a bug or want to request a feature, please open an issue on GitHub.

License

Flexi Grid is open-source and available under the MIT License.

Keywords

angular

FAQs

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