KTUIKTUI
KTUIKTUI
ComponentsDocsStudio

Getting Started

IntroductionInstallationApproachThemingJavaScriptDark modeRTLReferencesChangelog - v1.0.12Metronic TemplatePopular

Components

AccordionAvatarAlertBadgeBreadcrumbButtonCardCheckboxCollapseDatatableDatepickerSoonDismissDrawerDropdownImage InputInputUpdateKbdLinkModalPaginationProgressRadio GroupReparentScrollableScrollspyUpdateScrolltoSelectSeparatorSkeletonStepperStickySwitchTabsTextareaTheme SwitchToastNewTooltipToggleToggle GroupToggle PasswordTooltip
©2025 KtUI. All rights reserved.
A project by Keenthemes
Docs
Tailwind DataTable

Tailwind DataTable

Tailwind DataTable component simplifies the creation of interactive data tables for web applications. With features like sorting, pagination, and customizable layouts, for managing and displaying large datasets from static table or remote API endpoints.

Examples

Basic Usage

Tailwind DataTable example that loads data from a local HTML table element and enables pagination and sorting features for the dataset

<div class="grid w-full space-y-5">
  <div class="kt-card">
    <div class="kt-card-header min-h-16">
      <input
        type="text"
        placeholder="Search..."
        class="kt-input sm:w-48"
      /><button type="button" class="kt-btn kt-btn-outline">
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="24"
          height="24"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          stroke-width="2"
          stroke-linecap="round"
          stroke-linejoin="round"
          class="lucide lucide-plus"
          aria-hidden="true"
        >
          <path d="M5 12h14"></path>
          <path d="M12 5v14"></path></svg
        >Add
      </button>
    </div>
    <div
      class="kt-card-table"
      data-kt-datatable="true"
      data-kt-datatable-page-size="5"
      data-kt-datatable-state-save="true"
    >
      <div class="kt-table-wrapper kt-scrollable">
        <table class="kt-table" data-kt-datatable-table="true">
          <thead>
            <tr>
              <th scope="col" class="w-30" data-kt-datatable-column="label">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Label</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th scope="col" class="w-20" data-kt-datatable-column="method">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Method</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th scope="col" class="w-24" data-kt-datatable-column="status">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Status</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th
                scope="col"
                class="w-24"
                data-kt-datatable-column="lastSession"
              >
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Last Session</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th
                scope="col"
                class="w-16"
                data-kt-datatable-column="actions"
              ></th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>Guy Hawkins</td>
              <td>Web</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>22 Jul 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Sales Dept</td>
              <td>SSH</td>
              <td>
                <span class="kt-badge kt-badge-destructive">Rejected</span>
              </td>
              <td>18 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Sales Dept</td>
              <td>Kerberos</td>
              <td><span class="kt-badge kt-badge-primary">Verified</span></td>
              <td>15 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Legal Dept</td>
              <td>Token</td>
              <td><span class="kt-badge kt-badge-warning">Pending</span></td>
              <td>30 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Finance Dept</td>
              <td>API Key</td>
              <td><span class="kt-badge kt-badge-warning">Pending</span></td>
              <td>28 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Design Dept</td>
              <td>FIDO U2F</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>16 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Compliance Dept</td>
              <td>OpenID</td>
              <td>
                <span class="kt-badge kt-badge-destructive">Rejected</span>
              </td>
              <td>11 Aug, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Alice Smith</td>
              <td>Biometric</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>19 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>HR Dept</td>
              <td>Basic auth</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>6 Aug, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Guy Hawkins</td>
              <td>Web</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>22 Jul 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Sales Dept</td>
              <td>SSH</td>
              <td>
                <span class="kt-badge kt-badge-destructive">Rejected</span>
              </td>
              <td>18 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Sales Dept</td>
              <td>Kerberos</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>15 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>Legal Dept</td>
              <td>Token</td>
              <td><span class="kt-badge kt-badge-warning">Pending</span></td>
              <td>30 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <!--begin:pagination-->
      <div class="kt-datatable-toolbar">
        <div class="kt-datatable-length">
          Show<select
            class="kt-select kt-select-sm w-16"
            name="perpage"
            data-kt-datatable-size="true"
          ></select
          >per page
        </div>
        <div class="kt-datatable-info">
          <span data-kt-datatable-info="true"></span>
          <div
            class="kt-datatable-pagination"
            data-kt-datatable-pagination="true"
          ></div>
        </div>
      </div>
      <!--end:pagination-->
    </div>
  </div>
</div>

Remote Data Source

Tailwind DataTable example that loads data from a remote API endpoint and enables server-side pagination and sorting features for the dataset.

<div class="grid w-full space-y-5">
  <div class="kt-card">
    <div class="kt-card-header min-h-16">
      <input
        type="text"
        placeholder="Search..."
        class="kt-input sm:w-48"
        data-kt-datatable-search="true"
      />
    </div>
    <div
      id="kt_datatable_remote_source"
      class="kt-card-table"
      data-kt-datatable-page-size="5"
      data-kt-datatable-state-save="true"
    >
      <div class="kt-table-wrapper kt-scrollable">
        <table class="kt-table" data-kt-datatable-table="true">
          <thead>
            <tr>
              <th scope="col" class="w-30" data-kt-datatable-column="label">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Label</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th scope="col" class="w-20" data-kt-datatable-column="method">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Method</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th scope="col" class="w-24" data-kt-datatable-column="status">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Status</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th
                scope="col"
                class="w-24"
                data-kt-datatable-column="lastSession"
              >
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Last Session</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th scope="col" class="w-24" data-kt-datatable-column="ipAddress">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">IP Address</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
            </tr>
          </thead>
          <tbody></tbody>
        </table>
      </div>
      <!--begin:pagination-->
      <div class="kt-datatable-toolbar">
        <div class="kt-datatable-length">
          Show<select
            class="kt-select kt-select-sm w-16"
            name="perpage"
            data-kt-datatable-size="true"
          ></select
          >per page
        </div>
        <div class="kt-datatable-info">
          <span data-kt-datatable-info="true"></span>
          <div
            class="kt-datatable-pagination"
            data-kt-datatable-pagination="true"
          ></div>
        </div>
      </div>
      <!--end:pagination-->
    </div>
  </div>
</div>

Group Check

Tailwind DataTable example that enables group check features to easily select multiple table rows through a single checkbox.

<div class="grid w-full space-y-5">
  <div class="kt-card">
    <div class="kt-card-header min-h-16">
      <input
        type="text"
        placeholder="Search..."
        class="kt-input sm:w-48"
      /><button type="button" class="kt-btn kt-btn-outline">
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="24"
          height="24"
          viewBox="0 0 24 24"
          fill="none"
          stroke="currentColor"
          stroke-width="2"
          stroke-linecap="round"
          stroke-linejoin="round"
          class="lucide lucide-plus"
          aria-hidden="true"
        >
          <path d="M5 12h14"></path>
          <path d="M12 5v14"></path></svg
        >Add
      </button>
    </div>
    <div
      class="kt-card-table"
      data-kt-datatable="true"
      data-kt-datatable-page-size="5"
      data-kt-datatable-state-save="true"
    >
      <div class="kt-table-wrapper kt-scrollable">
        <table class="kt-table kt-table-border" data-kt-datatable-table="true">
          <thead>
            <tr>
              <th scope="col" class="w-5">
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-check="true"
                />
              </th>
              <th scope="col" class="w-30" data-kt-datatable-column="label">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Label</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th scope="col" class="w-20" data-kt-datatable-column="method">
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Method</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th scope="col" class="w-24" data-kt-datatable-column="status">
                <span class="kt-table-col asc"
                  ><span class="kt-table-col-label">Status</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th
                scope="col"
                class="w-24"
                data-kt-datatable-column="lastSession"
              >
                <span class="kt-table-col"
                  ><span class="kt-table-col-label">Last Session</span
                  ><span class="kt-table-col-sort"></span
                ></span>
              </th>
              <th
                scope="col"
                class="w-16"
                data-kt-datatable-column="actions"
              ></th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="0"
                />
              </td>
              <td>Guy Hawkins</td>
              <td>Web</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>22 Jul 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="1"
                />
              </td>
              <td>Sales Dept</td>
              <td>SSH</td>
              <td>
                <span class="kt-badge kt-badge-destructive">Rejected</span>
              </td>
              <td>18 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="2"
                />
              </td>
              <td>Sales Dept</td>
              <td>Kerberos</td>
              <td><span class="kt-badge kt-badge-primary">Verified</span></td>
              <td>15 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="3"
                />
              </td>
              <td>Legal Dept</td>
              <td>Token</td>
              <td><span class="kt-badge kt-badge-warning">Pending</span></td>
              <td>30 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="4"
                />
              </td>
              <td>Finance Dept</td>
              <td>API Key</td>
              <td><span class="kt-badge kt-badge-warning">Pending</span></td>
              <td>28 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="5"
                />
              </td>
              <td>Design Dept</td>
              <td>FIDO U2F</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>16 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="6"
                />
              </td>
              <td>Compliance Dept</td>
              <td>OpenID</td>
              <td>
                <span class="kt-badge kt-badge-destructive">Rejected</span>
              </td>
              <td>11 Aug, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="7"
                />
              </td>
              <td>Alice Smith</td>
              <td>Biometric</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>19 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="8"
                />
              </td>
              <td>HR Dept</td>
              <td>Basic auth</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>6 Aug, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="9"
                />
              </td>
              <td>Guy Hawkins</td>
              <td>Web</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>22 Jul 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="10"
                />
              </td>
              <td>Sales Dept</td>
              <td>SSH</td>
              <td>
                <span class="kt-badge kt-badge-destructive">Rejected</span>
              </td>
              <td>18 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="11"
                />
              </td>
              <td>Sales Dept</td>
              <td>Kerberos</td>
              <td><span class="kt-badge kt-badge-success">Approved</span></td>
              <td>15 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
            <tr>
              <td>
                <input
                  type="checkbox"
                  class="kt-checkbox"
                  data-kt-datatable-row-check="true"
                  value="12"
                />
              </td>
              <td>Legal Dept</td>
              <td>Token</td>
              <td><span class="kt-badge kt-badge-warning">Pending</span></td>
              <td>30 Jul, 2024</td>
              <td class="text-end">
                <span class="inline-flex gap-2.5"
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-pencil"
                      aria-hidden="true"
                    >
                      <path
                        d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"
                      ></path>
                      <path d="m15 5 4 4"></path></svg></a
                  ><a
                    href="#"
                    class="kt-btn kt-btn-sm kt-btn-icon kt-btn-outline"
                    ><svg
                      xmlns="http://www.w3.org/2000/svg"
                      width="24"
                      height="24"
                      viewBox="0 0 24 24"
                      fill="none"
                      stroke="currentColor"
                      stroke-width="2"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      class="lucide lucide-trash"
                      aria-hidden="true"
                    >
                      <path d="M3 6h18"></path>
                      <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path>
                      <path
                        d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"
                      ></path></svg></a
                ></span>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <!--begin:pagination-->
      <div class="kt-datatable-toolbar">
        <div class="kt-datatable-length">
          Show<select
            class="kt-select kt-select-sm w-16"
            name="perpage"
            data-kt-datatable-size="true"
          ></select
          >per page
        </div>
        <div class="kt-datatable-info">
          <span data-kt-datatable-info="true"></span>
          <div
            class="kt-datatable-pagination"
            data-kt-datatable-pagination="true"
          ></div>
        </div>
      </div>
      <!--end:pagination-->
    </div>
  </div>
</div>

Components API

Options

These options allow you to set options for the datatable component during auto initialization.

OptionTypeDefaultDescription
Data Options
data-kt-datatable-state-savebooleantrueSaves the state of the DataTable (e.g., pagination, sorting) so it can be restored when the user returns to the page.
data-kt-datatable-page-sizenumber10Sets the number of records to display per page in the DataTable. This value can be customized as needed.
JavaScript Options
requestMethodenum"GET"Defines the HTTP request method to be used for data fetching.
requestHeadersobject{"Content-Type": "application/x-www-form-urlencoded"}Specifies the headers to be sent with the request. For more info, check JavaScript Request Headers .
infostring"{start}-{end} of {total}"Template for displaying the current page information in the DataTable.
infoEmptystring"No records found"Message displayed when no records are found in the DataTable.
pageSizesarray[5, 10, 20, 30, 50]Defines the available page size options for the DataTable.
pageSizenumber10Sets the default number of records displayed per page.
pageMorebooleantrueDisplays a more pages ... indicator if the number of pages exceeds the pageMoreLimit value.
pageMoreLimitnumber3Sets the threshold for displaying the "more pages" indicator.
paginationobjectsee codePagination options for controlling the DataTable navigation.
sortobjectsee codeSorting options for configuring how DataTable columns are sorted.
searchobjectsee codeSearching options for configuring how DataTable columns are filtered when searching.
loadingobjectsee codeLoading options to manage the DataTable loading state.
attributesobjectsee codeSpecifies the selectors for the elements to be targeted.
stateSavebooleantrueEnables saving the state of the DataTable (e.g., pagination, sorting) for persistence across page reloads.
columnsobjectundefinedOptional. Defines custom column rendering and cell creation logic.

Selectors

This table details the custom classes and data attributes used by the DataTable component.

NameDescription
Data Attributes
data-kt-datatableUsed to auto-initialize KTDataTable instances on page load. Alternatively, you can remove it and perform initialization using JavaScript.
data-kt-datatable-tableIdentifies the main table element for the DataTable.
data-kt-datatable-columnUsed on <th> elements to identify columns.
data-kt-datatable-column-sortUsed on <th> elements to enable sorting for that column.
data-kt-datatable-checkIdentifies the group checkbox control used to select multiple rows.
data-kt-datatable-row-checkIdentifies the individual checkbox control for each row.
data-kt-datatable-infoIdentifies the element that displays the current page number and total pages.
data-kt-datatable-sizeMarks the select control that allows users to change the number of records displayed per page.
data-kt-datatable-paginationIdentifies the pagination element that enables users to navigate through different pages.
Classes
kt-tableBase class for the DataTable element. It wraps the entire table content and provides basic styling and behavior.
kt-table-gridAdds border styling to the DataTable for visual separation and emphasis.
kt-table-sortEnables sorting functionality for the DataTable columns.
kt-table-sort-labelApplied to the label element within the sortable column to indicate sorting.
kt-table-sort-iconApplied to the icon element within the sortable column to visually represent sorting direction.
ascIndicates that a column in the DataTable is sorted in ascending order.
descIndicates that a column in the DataTable is sorted in descending order.

Tailwind Modifiers

Custom modifiers to control the DataTable's style and behavior with Tailwind classes.

NameDescription
kt-datatable-loadingApplies specific styles when the DataTable is loading, triggered by actions such as pagination, page size change, or sorting.
kt-datatable-initializedApplies specific styles when the DataTable has fully initialized and is ready for user interaction.
kt-datatable-sort-ascApplies specific styles when a column in the DataTable is sorted in ascending order.
kt-datatable-sort-descApplies specific styles when a column in the DataTable is sorted in descending order.

Methods

Use KTDataTable component's API methods to programmatically control its behavior.

MethodDescription
new KTDataTable(element, options)Creates an instance of the KTDataTable class for the given DOM element and configuration options. This initializes the DataTable with the specified settings and binds it to the provided HTML element.
sort(field: string | number)Sorts the DataTable based on the specified field, which can be a column name string or column index number. This method reorders the rows according to the sort criteria applied to the field.
search(query: string | object)Searches the DataTable for rows that match the specified text string or object. This method filters the rows to display only those that contain the search query.
goPage(page: number)Navigates to the specified page number in the DataTable. This method updates the displayed rows to correspond with the chosen page.
reload()Reloads the DataTable data. This method refreshes the DataTable, fetching the latest data and updating the display accordingly.
setPageSize(pageSize: number)Sets the number of records to display per page in the DataTable. This method adjusts the pagination settings to accommodate the specified page size.
showSpinner()Displays a loading spinner overlay on the DataTable. This method is useful for indicating that data is being loaded or processed.
hideSpinner()Hides the loading spinner overlay from the DataTable. This method is used to indicate that data loading or processing is complete.
dispose()Removes the KTDataTable instance from an element, including any associated data stored on the DOM element.
isChecked()Returns true if the group checkbox is checked, otherwise false.
toggle()Toggles the group checkbox state between checked and unchecked.
check()Checks all visible row checkboxes.
uncheck()Unchecks all visible row checkboxes.
getChecked()Returns an array of the checked row IDs.
update()Reapplies checked state to visible checkboxes (after redraw/pagination).
getState()Returns the current state object of the DataTable.
const datatableEl = document.querySelector('#my_datatable');
const options = {
  pageSize: 5,
  stateSave: true,
};
const datatable = new KTDataTable(datatableEl, options);
 
datatable.reload();
datatable.showSpinner();

Utilities

Manage and interact with KTDataTable instances using these static methods of the KTDataTable JavaScript class.

MethodDescription
init()Automatically initializes KTDataTable objects for all elements with the data-kt-datatable="true" attribute on page load.
createInstances()Creates KTDataTable instances for all elements that have been dynamically added to the DOM but haven't been activated yet.
getInstance(element)Returns the KTDataTable object associated with the given DOM element element.
// Initialize all datatables
KTDataTable.init();
 
// Initialize pending datatables
KTDataTable.createInstances();
 
// Get datatable object
const datatableEl = document.querySelector('#my_datatable');
const datatable = KTDataTable.getInstance(datatableEl);

Events

KTDataTable custom events allow you to register callback functions (event listeners) that will be invoked automatically whenever specific custom events are triggered within the component.

EventDescription
initTriggered immediately after the DataTable is initialized.
drawTriggered immediately before the DataTable is drawn and displayed.
drewTriggered immediately after the DataTable is drawn and displayed.
redrawTriggered immediately after the DataTable is redrawn, typically after updates or changes.
fetchTriggered immediately before data is fetched for the DataTable.
fetchedTriggered immediately after data has been fetched for the DataTable.
sortTriggered immediately after the DataTable is sorted.
checkedTriggered immediately after rows checkbox is checked.
uncheckedTriggered immediately after rows checkbox is unchecked.
reloadTriggered immediately after the DataTable is reloaded.
paginationTriggered immediately before the DataTable pagination is updated.
stateSaveTriggered immediately before the DataTable state is saved.
errorTriggered if there is an error during data fetching or processing.
const datatableEl = document.querySelector('#my_datatable');
const options = {
  pageSize: 5,
  stateSave: true,
};
const datatable = new KTDataTable(datatableEl, options);
 
datatable.on('init', () => {
  console.log('init event');
});
 
datatable.on('draw', () => {
  console.log('draw event');
});
PreviouseCollapseNextDatepicker

On This Page

  • Examples
    • Basic Usage
    • Remote Data Source
    • Group Check
  • Components API
    • Options
    • Selectors
    • Tailwind Modifiers
    • Methods
    • Utilities
    • Events