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 🙏

© 2026 – Pkg Stats / Ryan Hefner

xyrlan-table

v1.1.8

Published

Biblioteca de tabela dinâmica reutilizável para React

Downloads

43

Readme

Xyrlan Table

Xyrlan Table is a reusable dynamic table library for React applications with focus on productivity and integration with APIs based on pagination, sorting and filtering — ideal for Next.js, Prisma and SWR projects.

✨ Features

  • Ordenação por colunas
  • Paginação e controle de página
  • Filtros dinâmicos e busca full-text
  • Seleção de múltiplos itens
  • Renderização customizada de células
  • Mutação integrada com SWR
  • Suporte a botão de "Adicionar novo item"
  • Integração simples com API RESTful ou função personalizada

📦 Installation

npm install xyrlan-table
# ou
yarn add xyrlan-table

🧱 Basic Usage

import { XyrlanTable } from 'xyrlan-table';
import DefaultLayout from "@/layouts/default";

export default function IndexPage() {
  const columns = [
    { name: "ID", uid: "id" },
    { name: "Post ID", uid: "postId", sortable: true },
    { name: "Name", uid: "name" },
    { name: "Email", uid: "email" },
    { name: "Body", uid: "body" },
    { name: "Ações", uid: "actions" },
  ];

  return (
    <DefaultLayout>
      <XyrlanTable
        baseUrl="https://jsonplaceholder.typicode.com"
        columns={columns}
        endpoint="/comments"
        initialVisibleColumns={["id", "postId", "name", "email", "body", "actions"]}
        searchFields={["name", "email"]}
      />
    </DefaultLayout>
  );
}

🧱 Props

| Prop | Type | Default | Description | | ----------------------- | ----------------------------------------------------------------------------------- | ----------------------------- | -------------------------------------- | | endpoint | string | Required | API endpoint for default data provider | | columns | Column<T>[] | Required | Column definitions | | initialVisibleColumns | (keyof T "actions")[] | Required | Initially visible columns | | searchFields | (keyof T)[] | Required | Fields for full-text search | | baseUrl | string | process.env.NEXT_PUBLIC_URL | Base URL for API requests | | dataProvider | (params: any) => Promise<{ items: T[]; totalCount: number }> | Optional | Custom data fetching function | | renderCellMap | Partial<Record<keyof T | "actions", (item: T, mutate?: any) => React.ReactNode>> | Optional | Custom cell renderer | | addNewItem | boolean | Optional | Show "Add New" button | | addNewItemComponent | React.ReactNode | ((mutate: any) => React.ReactNode) | Optional | Custom "Add New" component |

Data Handling

The component sends requests with the following query parameters structure:

{
  queryCriteria: {
    page: number,
    pageSize: number,
    orderBy: Record<string, 'asc' | 'desc'>,
    includes: Record<string, boolean>,
    params: Record<string, any>
  }
}

Example Next.js API handler with Next.js + Prisma:

export async function GET(request: NextRequest) {
  const queryCriteria = JSON.parse(request.nextUrl.searchParams.get("queryCriteria") || "{}");
  
  const page = queryCriteria.page || 1;
  const pageSize = queryCriteria.pageSize || 10;
  const skip = (page - 1) * pageSize;

  // Your data fetching logic here
  const [data, total] = await Promise.all([ 
    prisma.entity.findMany({
      where: queryCriteria.params,
      take: pageSize,
      skip,
      orderBy: queryCriteria.orderBy,
      include: queryCriteria.includes,
    }),
    prisma.entity.count({ where: queryCriteria.params })
  ]);

  return NextResponse.json({
    data,
    paging: {
      totalCount: total,
      page,
      pageSize
    }
  });
}

Custom Cell Rendering

If you want to customize only the "actions" or "status" column, just do:

<XyrlanTable
  renderCellMap={{
    status: (user) => (
      <Chip color={user.status === "active" ? "success" : "danger"}>
        {user.status}
      </Chip>
    ),
    actions: (user) => <MyActions user={user} />,
  }}
/>

If renderCellMap is not passed, all columns fall back to defaultRenderCell.