1.0.2 • Published 2 years ago

tailwind-table v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Tailwind Table

Downloads Version Contributors

Simple usage customizable table with TailwindCSS e Typescript

How to use?

The Table component can recives this parameters:

  • data:

    Array with datas to render on table;

    • Example:
    [
      {
        name: "Sofia Oliveira",
        email: "sofia.oliveira@example.com",
        status: "Ativo",
        role: "Admin",
      },
      {
        name: "João Santos",
        email: "joao.santos@example.com",
        status: "Suspenso",
        role: "Usuário",
      },
    ];
  • columns:

    Array with columns that will be displayed in the table.

    • Example:
    [
      {
        title: "Nome", // Title of column that will be displayed.
        key: "name", // Key of data object that represents this column.
      },
      {
        title: "Email",
        key: "email",
      },
    ];
  • pagination:

    Optional. Depending on your pagination method, you can use some techniques to achieve the following information.

    • Example:
    {
        currentPage: number;
        pagesTotal: number;
        itemsPerPageProps: PaginationItemsPerPageProps;
        onClickPrev: MouseEventHandler<HTMLButtonElement>;
        onClickNext: MouseEventHandler<HTMLButtonElement>;
    }

    The first two attributes are self-explanatory. The last two are callback functions that will be executed when clicking on the pagination buttons.

    PaginationItemsPerPageProps are optional and can recive this props:

    {
        itemsPerPage: "10";
        text: "Usuários por página";
        setItemsPerPage: (itemsPerPage) => setState(itemsPerPage);
        options: [5,10,20,50];
        classNames: {
    	    text: "",
    	    input: "",
    	    div: "",
    	};
    }
  • paginationTexts:

    Optional. If you prefer, pass the texts that will appear in the pagination.

    • Example:
    {
        pageText: "Página", // Page
        prevText: "Anterior", // Previous
        nextText: "Próxima", // Next
    }
  • classNames:

    Optional. Object that can contain: table, thead, tbody. This add your custom className (tailwind style) to this elements of table.

    • Example:
    {
        table: "rounded-lg",
        thead: "text-gray-800",
        tbody: "bg-white",
    }
  • tableHeadClassNames:

    Optional. Object that can contain: tr, th. This add your custom className (tailwind style) to this elements of table.

  • tableRowsClassNames:

    Optional. Object that can contain: tr, td. This add your custom className (tailwind style) to this elements of table.

You can see the result here.

Contributing

Feel free to contribute 😁

1.0.2

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago