Skip to content

Success Message (CRUD)

Tailwind CSS Success Message (CRUD) - Flowbite

Use a collection of success message components based on Tailwind CSS to share feedback with your users based on their actions inside your application.

Default success message

Tailwind CSS Success Message (CRUD) - Flowbite

Use this free example of a success message component inside a modal to share feedback with your user when an action has been completed.

Default success message
html
<!-- Modal toggle -->
<div class="flex justify-center m-5">
  <button
    id="successButton"
    data-modal-target="successModal"
    data-modal-toggle="successModal"
    class="block text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
    type="button"
  >
    Show success message
  </button>
</div>

<!-- Main modal -->
<div
  id="successModal"
  tabindex="-1"
  aria-hidden="true"
  class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-modal md:h-full"
>
  <div class="relative p-4 w-full max-w-md h-full md:h-auto">
    <!-- Modal content -->
    <div
      class="relative p-4 text-center bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5"
    >
      <button
        type="button"
        class="text-gray-400 absolute top-2.5 right-2.5 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
        data-modal-toggle="successModal"
      >
        <svg
          aria-hidden="true"
          class="w-5 h-5"
          fill="currentColor"
          viewBox="0 0 20 20"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            fill-rule="evenodd"
            d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
            clip-rule="evenodd"
          ></path>
        </svg>
        <span class="sr-only">Close modal</span>
      </button>
      <div
        class="w-12 h-12 rounded-full bg-green-100 dark:bg-green-900 p-2 flex items-center justify-center mx-auto mb-3.5"
      >
        <svg
          aria-hidden="true"
          class="w-8 h-8 text-green-500 dark:text-green-400"
          fill="currentColor"
          viewBox="0 0 20 20"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            fill-rule="evenodd"
            d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
            clip-rule="evenodd"
          ></path>
        </svg>
        <span class="sr-only">Success</span>
      </div>
      <p class="mb-4 text-lg font-semibold text-gray-900 dark:text-white">
        Successfully removed product.
      </p>
      <button
        data-modal-toggle="successModal"
        type="button"
        class="py-2 px-3 text-sm font-medium text-center text-white rounded-lg bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 dark:focus:ring-primary-900"
      >
        Continue
      </button>
    </div>
  </div>
</div>
js
document.addEventListener('DOMContentLoaded', (event) => {
  document.getElementById('successButton').click()
})

Success message with list

Tailwind CSS Success Message (CRUD) - Flowbite

Use this example to show a list of items that have been modified or deleted when showing the success message inside a modal component.

Success message with list
html
<!-- Modal toggle -->
<div class="flex justify-center m-5">
  <button
    id="successListButton"
    data-modal-target="successListModal"
    data-modal-toggle="successListModal"
    class="block text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
    type="button"
  >
    Show success message
  </button>
</div>

<!-- Main modal -->
<div
  id="successListModal"
  tabindex="-1"
  aria-hidden="true"
  class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-modal md:h-full"
>
  <div class="relative p-4 w-full max-w-md h-full md:h-auto">
    <!-- Modal content -->
    <div
      class="relative p-4 bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5"
    >
      <button
        type="button"
        class="text-gray-400 absolute top-2.5 right-2.5 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
        data-modal-toggle="successListModal"
      >
        <svg
          aria-hidden="true"
          class="w-5 h-5"
          fill="currentColor"
          viewBox="0 0 20 20"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            fill-rule="evenodd"
            d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
            clip-rule="evenodd"
          ></path>
        </svg>
        <span class="sr-only">Close modal</span>
      </button>
      <h3 class="mb-1 text-lg font-semibold text-gray-900 dark:text-white">
        Products successfully deleted
      </h3>
      <p class="mb-4 font-light text-gray-500 dark:text-gray-400">
        The following products have been successfully remove from the database:
      </p>
      <ul
        role="list"
        class="mb-4 space-y-2 text-left text-gray-500 sm:mb-5 dark:text-gray-400"
      >
        <li class="flex items-center space-x-2">
          <svg
            aria-hidden="true"
            class="flex-shrink-0 w-4 h-4 text-green-500 dark:text-green-400"
            fill="currentColor"
            viewBox="0 0 20 20"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
              clip-rule="evenodd"
            ></path>
          </svg>
          <span>Apple iMac 27”</span>
        </li>
        <li class="flex items-center space-x-2">
          <svg
            aria-hidden="true"
            class="flex-shrink-0 w-4 h-4 text-green-500 dark:text-green-400"
            fill="currentColor"
            viewBox="0 0 20 20"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
              clip-rule="evenodd"
            ></path>
          </svg>
          <span>Magic Keyboard</span>
        </li>
        <li class="flex items-center space-x-2">
          <svg
            aria-hidden="true"
            class="flex-shrink-0 w-4 h-4 text-green-500 dark:text-green-400"
            fill="currentColor"
            viewBox="0 0 20 20"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
              clip-rule="evenodd"
            ></path>
          </svg>
          <span>Xbox Series X</span>
        </li>
      </ul>
      <button
        data-modal-toggle="successListModal"
        type="button"
        class="py-2 px-3 text-sm font-medium text-center text-white rounded-lg bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 dark:focus:ring-primary-900"
      >
        Continue
      </button>
    </div>
  </div>
</div>
js
document.addEventListener('DOMContentLoaded', (event) => {
  document.getElementById('successListButton').click()
})

Success message with item details

Tailwind CSS Success Message (CRUD) - Flowbite

Use this example of a success message component to show the details of an item that has been removed or modified including an image.

Success message with item details
html
<!-- Modal toggle -->
<div class="flex justify-center m-5">
  <button
    id="successProductButton"
    data-modal-target="successProductModal"
    data-modal-toggle="successProductModal"
    class="block text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
    type="button"
  >
    Show success message
  </button>
</div>

<!-- Main modal -->
<div
  id="successProductModal"
  tabindex="-1"
  aria-hidden="true"
  class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-modal md:h-full"
>
  <div class="relative p-4 w-full max-w-md h-full md:h-auto">
    <!-- Modal content -->
    <div
      class="relative p-4 text-center bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5"
    >
      <button
        type="button"
        class="text-gray-400 absolute top-2.5 right-2.5 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
        data-modal-toggle="successProductModal"
      >
        <svg
          aria-hidden="true"
          class="w-5 h-5"
          fill="currentColor"
          viewBox="0 0 20 20"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            fill-rule="evenodd"
            d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
            clip-rule="evenodd"
          ></path>
        </svg>
        <span class="sr-only">Close modal</span>
      </button>
      <svg
        aria-hidden="true"
        class="mx-auto mb-4 w-11 h-11 text-green-400"
        fill="currentColor"
        viewBox="0 0 20 20"
        xmlns="http://www.w3.org/2000/svg"
      >
        <path
          fill-rule="evenodd"
          d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
          clip-rule="evenodd"
        ></path>
      </svg>
      <span class="sr-only">Success icon</span>
      <div
        class="flex items-center justify-center p-2 mb-3.5 space-x-3 bg-gray-100 dark:bg-gray-700 rounded-lg"
      >
        <img
          class="w-11 h-11"
          src="https://flowbite.s3.amazonaws.com/blocks/application-ui/products/imac-side-image.png"
          alt="imac"
        />
        <div class="text-left">
          <p class="font-semibold text-gray-900 dark:text-white">
            Apple iMac 27"
          </p>
          <p class="text-sm text-gray-500 dark:text-gray-400">
            256GB SSD, Apple M1
          </p>
        </div>
      </div>
      <p class="mb-4 text-lg font-light text-gray-500 dark:text-gray-400">
        This product was successfully deleted.
      </p>
      <button
        data-modal-toggle="successProductModal"
        type="button"
        class="py-2 px-3 text-sm font-medium text-center text-white rounded-lg bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 dark:focus:ring-primary-900"
      >
        Continue
      </button>
    </div>
  </div>
</div>
js
document.addEventListener('DOMContentLoaded', (event) => {
  document.getElementById('successProductButton').click()
})

Success message with description

Tailwind CSS Success Message (CRUD) - Flowbite

Use this example to show a short description of the previous action result when showing a success message modal component.

Success message with description
html
<!-- Modal toggle -->
<div class="flex justify-center m-5">
  <button
    id="successUserButton"
    data-modal-target="successUserModal"
    data-modal-toggle="successUserModal"
    class="block text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
    type="button"
  >
    Show success message
  </button>
</div>

<!-- Main modal -->
<div
  id="successUserModal"
  tabindex="-1"
  aria-hidden="true"
  class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-modal md:h-full"
>
  <div class="relative p-4 w-full max-w-md h-full md:h-auto">
    <!-- Modal content -->
    <div
      class="relative p-4 bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5"
    >
      <button
        type="button"
        class="text-gray-400 absolute top-2.5 right-2.5 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
        data-modal-toggle="successUserModal"
      >
        <svg
          aria-hidden="true"
          class="w-5 h-5"
          fill="currentColor"
          viewBox="0 0 20 20"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            fill-rule="evenodd"
            d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
            clip-rule="evenodd"
          ></path>
        </svg>
        <span class="sr-only">Close modal</span>
      </button>
      <div class="flex items-center space-x-1.5 mb-2">
        <div
          class="flex justify-center items-center w-6 h-6 bg-green-100 rounded-full dark:bg-green-900"
        >
          <svg
            aria-hidden="true"
            class="w-4 h-4 text-green-500 dark:text-green-400"
            fill="currentColor"
            viewBox="0 0 20 20"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
              clip-rule="evenodd"
            ></path>
          </svg>
          <span class="sr-only">Success icon</span>
        </div>
        <h3 class="text-lg font-medium text-green-500 dark:text-green-400">
          User deleted!
        </h3>
      </div>
      <p class="mb-4 font-light text-gray-500 dark:text-gray-400">
        User
        <span class="font-semibold text-gray-900 dark:text-white"
          >@bonnieGr</span
        >
        has been successfully removed.
      </p>
      <button
        data-modal-toggle="successUserModal"
        type="button"
        class="py-2 px-3 text-sm font-medium text-center text-white rounded-lg bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 dark:focus:ring-primary-900"
      >
        Continue
      </button>
    </div>
  </div>
</div>
js
document.addEventListener('DOMContentLoaded', (event) => {
  document.getElementById('successUserButton').click()
})

Success message with repository

Tailwind CSS Success Message (CRUD) - Flowbite

This example can be used to show the repository or project that has been removed or modified inside your success message modal component.

Success message with repository
html
<!-- Modal toggle -->
<div class="flex justify-center m-5">
  <button
    id="successFormButton"
    data-modal-target="successFormModal"
    data-modal-toggle="successFormModal"
    class="block text-white bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
    type="button"
  >
    Success success message
  </button>
</div>

<!-- Main modal -->
<div
  id="successFormModal"
  tabindex="-1"
  aria-hidden="true"
  class="hidden overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-modal md:h-full"
>
  <div class="relative p-4 w-full max-w-lg h-full md:h-auto">
    <!-- Modal content -->
    <div
      class="relative p-4 bg-white rounded-lg shadow dark:bg-gray-800 sm:p-5"
    >
      <div class="flex justify-between items-center mb-3">
        <h3
          class="text-lg font-semibold leading-none text-gray-900 dark:text-white"
        >
          Awesome!
        </h3>
        <button
          type="button"
          class="text-gray-400 bg-transparent absolute top-2.5 right-2.5 hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center dark:hover:bg-gray-600 dark:hover:text-white"
          data-modal-toggle="successFormModal"
        >
          <svg
            aria-hidden="true"
            class="w-5 h-5"
            fill="currentColor"
            viewBox="0 0 20 20"
            xmlns="http://www.w3.org/2000/svg"
          >
            <path
              fill-rule="evenodd"
              d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
              clip-rule="evenodd"
            ></path>
          </svg>
          <span class="sr-only">Close modal</span>
        </button>
      </div>
      <p class="text-gray-500 dark:text-gray-400">
        The following repositories have been successfully deleted:
      </p>
      <div
        class="flex items-center space-x-1.5 font-light text-green-700 bg-green-100 border-t border-b border-green-200 dark:border-gray-600 dark:bg-gray-700 dark:text-green-300 mt-2 mb-4 sm:mb-5 p-4"
      >
        <svg
          aria-hidden="true"
          class="flex-shrink-0 w-4 h-4"
          fill="currentColor"
          viewBox="0 0 20 20"
          xmlns="http://www.w3.org/2000/svg"
        >
          <path
            fill-rule="evenodd"
            d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z"
            clip-rule="evenodd"
          ></path>
        </svg>
        <p class="font-medium leading-none">bergside/flowbite-library</p>
      </div>
      <button
        data-modal-toggle="successFormModal"
        type="button"
        type="submit"
        class="justify-center py-2 px-3 w-full text-sm font-medium text-center text-white rounded-lg bg-primary-600 hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 dark:focus:ring-primary-900"
      >
        Continue
      </button>
    </div>
  </div>
</div>
js
document.addEventListener('DOMContentLoaded', (event) => {
  document.getElementById('successFormButton').click()
})