Published on

3 Things You Must Know To Create A Testimonial UI with TailwindCSS and AlpineJS With Tailwind CSS

Testimonial UI with TailwindCSS and AlpineJS

What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework that focuses on creating personalized user interfaces quickly. It can gives you all the building blocks you are able to create personalized designs without having to fight to override irritating opinionated styles. Also, Tailwind CSS is a highly configurable, low-level CSS framework.

The description of Testimonial UI with TailwindCSS and AlpineJS ui component

Why use Tailwind CSS to create a Testimonial UI with TailwindCSS and AlpineJS ui component?

  • It can make the building process of Testimonial UI with TailwindCSS and AlpineJS ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Testimonial UI with TailwindCSS and AlpineJS component file.

The preview of Testimonial UI with TailwindCSS and AlpineJS ui component

Free download of the Testimonial UI with TailwindCSS and AlpineJS's source code

The source code of Testimonial UI with TailwindCSS and AlpineJS ui component

<!-- This is an example component -->
<div>
	<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="description" content="" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        <!-- Primary Meta Tags -->
        <title>Testimonial with AplineJS and TailwindCSS</title>
        <meta name="title" content="Content Title" />
		<meta name="description" content="Content Description." />
		
		<link href="https://fonts.googleapis.com/css2?family=Zilla+Slab:[email protected]&display=swap" rel="stylesheet">
		<link href="https://unpkg.com/[email protected]^1.0/dist/tailwind.min.css" rel="stylesheet">
		<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
		<style>
			.serif {
				font-family: 'Zilla Slab', serif;
			}

			[x-cloak] { display: none; }

			.grid-indigo {
				background-image: radial-gradient(#5a67d8 2px, transparent 2px);
				background-size: 16px 16px;
			}
		</style>
    </head>

    <body class="antialiased sans-serif bg-gray-200 text-gray-600">
		
		<div class="my-10 md:my-24 container mx-auto flex flex-col md:flex-row shadow-sm overflow-hidden" x-data="{ testimonialActive: 2 }" x-cloak>
			<div class="relative w-full py-2 md:py-24 bg-indigo-700 md:w-1/2 flex flex-col item-center justify-center">
				
				<div class="absolute top-0 left-0 z-10 grid-indigo w-16 h-16 md:w-40 md:h-40 md:ml-20 md:mt-24"></div>
				
				<div class="relative text-2xl md:text-5xl py-2 px-6 md:py-6 md:px-1 md:w-64 md:mx-auto text-indigo-100 font-semibold leading-tight tracking-tight mb-0 z-20">
					<span class="md:block">What Our</span>
					<span class="md-block">Customers</span>
					<span class="block">Are Saying!</span>
				</div>

				<div class="absolute right-0 bottom-0 mr-4 mb-4 hidden md:block">
					<button 
						class="rounded-l-full border-r bg-gray-100 text-gray-500 focus:outline-none hover:text-indigo-500 font-bold w-12 h-10"
						x-on:click="testimonialActive = testimonialActive === 1 ? 3 : testimonialActive - 1">
						&#8592;
					</button><button 
						class="rounded-r-full bg-gray-100 text-gray-500 focus:outline-none hover:text-indigo-500 font-bold w-12 h-10"
						x-on:click="testimonialActive = testimonialActive >= 3 ? 1 : testimonialActive + 1">
						&#8594;
					  </button>
				</div>
			</div>

			<div class="bg-gray-100 md:w-1/2">
				<div class="flex flex-col h-full relative">

					<div class="absolute top-0 left-0 mt-3 ml-4 md:mt-5 md:ml-12">
						<svg xmlns="http://www.w3.org/2000/svg" class="text-indigo-200 fill-current w-12 h-12 md:w-16 md:h-16" viewBox="0 0 24 24"><path d="M6.5 10c-.223 0-.437.034-.65.065.069-.232.14-.468.254-.68.114-.308.292-.575.469-.844.148-.291.409-.488.601-.737.201-.242.475-.403.692-.604.213-.21.492-.315.714-.463.232-.133.434-.28.65-.35.208-.086.39-.16.539-.222.302-.125.474-.197.474-.197L9.758 4.03c0 0-.218.052-.597.144C8.97 4.222 8.737 4.278 8.472 4.345c-.271.05-.56.187-.882.312C7.272 4.799 6.904 4.895 6.562 5.123c-.344.218-.741.4-1.091.692C5.132 6.116 4.723 6.377 4.421 6.76c-.33.358-.656.734-.909 1.162C3.219 8.33 3.02 8.778 2.81 9.221c-.19.443-.343.896-.468 1.336-.237.882-.343 1.72-.384 2.437-.034.718-.014 1.315.028 1.747.015.204.043.402.063.539.017.109.025.168.025.168l.026-.006C2.535 17.474 4.338 19 6.5 19c2.485 0 4.5-2.015 4.5-4.5S8.985 10 6.5 10zM17.5 10c-.223 0-.437.034-.65.065.069-.232.14-.468.254-.68.114-.308.292-.575.469-.844.148-.291.409-.488.601-.737.201-.242.475-.403.692-.604.213-.21.492-.315.714-.463.232-.133.434-.28.65-.35.208-.086.39-.16.539-.222.302-.125.474-.197.474-.197L20.758 4.03c0 0-.218.052-.597.144-.191.048-.424.104-.689.171-.271.05-.56.187-.882.312-.317.143-.686.238-1.028.467-.344.218-.741.4-1.091.692-.339.301-.748.562-1.05.944-.33.358-.656.734-.909 1.162C14.219 8.33 14.02 8.778 13.81 9.221c-.19.443-.343.896-.468 1.336-.237.882-.343 1.72-.384 2.437-.034.718-.014 1.315.028 1.747.015.204.043.402.063.539.017.109.025.168.025.168l.026-.006C13.535 17.474 15.338 19 17.5 19c2.485 0 4.5-2.015 4.5-4.5S19.985 10 17.5 10z"/></svg>
					</div>
					 
					<div class="h-full relative z-10">
						<div x-show.immediate="testimonialActive === 1">
							<p class="text-gray-600 serif font-normal italic px-6 py-6 md:px-16 md:py-10 text-xl md:text-2xl" x-show.transition="testimonialActive == 1">
								Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.
							</p>
						</div>
						
						<div x-show.immediate="testimonialActive === 2">
							<p class="text-gray-600 serif font-normal italic px-6 py-6 md:px-16 md:py-10 text-xl md:text-2xl" x-show.transition="testimonialActive == 2">
								Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.
							</p>
						</div>
						
						<div x-show.immediate="testimonialActive === 3"> 
							<p class="text-gray-600 serif font-normal italic px-6 py-6 md:px-16 md:py-10 text-xl md:text-2xl" x-show.transition="testimonialActive == 3">
								Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line.
							</p>
						</div>
					</div>

					<div class="flex my-4 justify-center items-center">
						<button 
							@click.prevent="testimonialActive = 1" 
							class="text-center font-bold shadow-xs focus:outline-none focus:shadow-outline inline-block rounded-full mx-2"
							:class="{'h-12 w-12 opacity-25 bg-indigo-300 text-gray-600': testimonialActive != 1, 'h-16 w-16 opacity-100 bg-indigo-600 text-white': testimonialActive == 1 }"	
						>JD</button>
						<button 
							@click.prevent="testimonialActive = 2" 
							class="text-center font-bold shadow-xs focus:outline-none focus:shadow-outline h-16 w-16 inline-block bg-indigo-600 rounded-full mx-2"
							:class="{'h-12 w-12 opacity-25 bg-indigo-300 text-gray-600': testimonialActive != 2, 'h-16 w-16 opacity-100 bg-indigo-600 text-white': testimonialActive == 2 }"	
						>WD</button>
						<button 
							@click.prevent="testimonialActive = 3" 
							class="text-center font-bold shadow-xs focus:outline-none focus:shadow-outline h-12 w-12 inline-block bg-indigo-600 rounded-full mx-2"
							:class="{'h-12 w-12 opacity-25 bg-indigo-300 text-gray-600': testimonialActive != 3, 'h-16 w-16 opacity-100 bg-indigo-600 text-white': testimonialActive == 3 }"
						>JW</button>
					</div>
					 
					<div class="flex justify-center px-6 pt-2 pb-6 md:py-6">
						<div class="text-center" x-show="testimonialActive == 1">
							<h2 class="text-sm md:text-base font-bold text-gray-700 leading-tight">John Doe</h2>
							<small class="text-gray-500 text-xs md:text-sm truncate">CEO, ABC Inc.</small>
						</div>

						<div class="text-center" x-show="testimonialActive == 2">
							<h2 class="text-sm md:text-base font-bold text-gray-700 leading-tight">Winter Doe</h2>
							<small class="text-gray-500 text-xs md:text-sm truncate">CTO, XYZ Corp.</small>
						</div>

						<div class="text-center" x-show="testimonialActive == 3">
							<h2 class="text-sm md:text-base font-bold text-gray-700 leading-tight">John Wick</h2>
							<small class="text-gray-500 text-xs md:text-sm truncate">Product Manager, Fake Corp.</small>
						</div>	 
					</div>
				</div>
			</div>
		</div>
 
    </body>
</html>

</div>

How to create a Testimonial UI with TailwindCSS and AlpineJS with Tailwind CSS?

Install tailwind css of verion 1.4.6

Use the link html tag to import the stylesheet of Tailwind CSS of the version 1.4.6

<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">

All the unility class needed to create a Testimonial UI with TailwindCSS and AlpineJS component

  • bg-gray-200
  • text-gray-600
  • my-10
  • md:my-24
  • mx-auto
  • flex
  • flex-col
  • md:flex-row
  • overflow-hidden
  • relative
  • w-full
  • py-2
  • md:py-24
  • bg-indigo-700
  • md:w-1/2
  • absolute
  • top-0
  • left-0
  • z-10
  • grid-indigo
  • w-16
  • h-16
  • md:w-40
  • md:h-40
  • md:ml-20
  • md:mt-24
  • text-2xl
  • md:text-5xl
  • px-6
  • md:py-6
  • md:px-1
  • md:w-64
  • md:mx-auto
  • text-indigo-100
  • mb-0
  • z-20
  • md:block
  • block
  • right-0
  • bottom-0
  • mr-4
  • mb-4
  • hidden
  • border-r
  • bg-gray-100
  • text-gray-500
  • hover:text-indigo-500
  • w-12
  • h-10
  • h-full
  • mt-3
  • ml-4
  • md:mt-5
  • md:ml-12
  • text-indigo-200
  • h-12
  • md:w-16
  • md:h-16
  • py-6
  • md:px-16
  • md:py-10
  • text-xl
  • md:text-2xl
  • my-4
  • text-center
  • inline-block
  • mx-2
  • bg-indigo-300
  • bg-indigo-600
  • text-white
  • pt-2
  • pb-6
  • text-sm
  • md:text-base
  • text-gray-700
  • text-xs
  • md:text-sm

77 steps to create a Testimonial UI with TailwindCSS and AlpineJS component with Tailwind CSS

  1. Control the background color of an element to gray-200 using the bg-gray-200 utilities.

  2. Control the text color of an element to gray-600 using the text-gray-600 utilities.

  3. Control the vertical margin of an element to 2.5rem using the my-10 utilities.

  4. Control the vertical margin of an element to 6rem at only medium screen sizes using the md:my-24 utilities.

  5. Control the horizontal margin of an element to auto using the mx-auto utilities.

  6. Use flex to create a block-level flex container.

  7. Use flex to create a block-level flex container.

  8. Use flex to create a block-level flex container at only medium screen sizes.

  9. Use overflow-hidden to clip any content within an element that overflows the bounds of that element.

  10. Use relative to position an element according to the normal flow of the document.

  11. Use w-full to set an element to a 100% based width.

  12. Control the vertical padding of an element to 0.5rem using the py-2 utilities.

  13. Control the vertical padding of an element to 6rem at only medium screen sizes using the md:py-24 utilities.

  14. Control the background color of an element to indigo-700 using the bg-indigo-700 utilities.

  15. Use md:w-1/2 to set an element to a fixed width(1/2) at only medium screen sizes.

  16. Use absolute to position an element outside of the normal flow of the document, causing neighboring elements to act as if the element doesn’t exist.

  17. Use the top-0 utilities to set the top position of a positioned element to 0rem.

  18. Use the left-0 utilities to set the left position of a positioned element to 0rem.

  19. Control the stack order (or three-dimensional positioning) of an element to 10 in Tailwind, regardless of order it has been displayed, using the z-10 utilities.

  20. Use grid to create a grid container.

  21. Use w-16 to set an element to a fixed width(4rem).

  22. Use h-16 to set an element to a fixed height(4rem).

  23. Use md:w-40 to set an element to a fixed width(10rem) at only medium screen sizes.

  24. Use md:h-40 to set an element to a fixed height(10rem) at only medium screen sizes.

  25. Control the margin on left side of an element to 5rem at only medium screen sizes using the md:ml-20 utilities.

  26. Control the margin on top side of an element to 6rem at only medium screen sizes using the md:mt-24 utilities.

  27. Control the text color of an element to 2xl using the text-2xl utilities.

  28. Control the text color of an element to 5xl at only medium screen sizes using the md:text-5xl utilities.

  29. Control the horizontal padding of an element to 1.5rem using the px-6 utilities.

  30. Control the vertical padding of an element to 1.5rem at only medium screen sizes using the md:py-6 utilities.

  31. Control the horizontal padding of an element to 0.25rem at only medium screen sizes using the md:px-1 utilities.

  32. Use md:w-64 to set an element to a fixed width(16rem) at only medium screen sizes.

  33. Control the horizontal margin of an element to auto at only medium screen sizes using the md:mx-auto utilities.

  34. Control the text color of an element to indigo-100 using the text-indigo-100 utilities.

  35. Control the margin on bottom side of an element to 0rem using the mb-0 utilities.

  36. Control the stack order (or three-dimensional positioning) of an element to 20 in Tailwind, regardless of order it has been displayed, using the z-20 utilities.

  37. Use inline utilities to put the element on its own line and fill its parent at only medium screen sizes.

  38. Use inline utilities to put the element on its own line and fill its parent.

  39. Use the right-0 utilities to set the right position of a positioned element to 0rem.

  40. Use the bottom-0 utilities to set the bottom position of a positioned element to 0rem.

  41. Control the margin on right side of an element to 1rem using the mr-4 utilities.

  42. Control the margin on bottom side of an element to 1rem using the mb-4 utilities.

  43. Use hidden to set an element to display: none and remove it from the page layout.

  44. Control the border color of an element to r using the border-r utilities.

  45. Control the background color of an element to gray-100 using the bg-gray-100 utilities.

  46. Control the text color of an element to gray-500 using the text-gray-500 utilities.

  47. Control the text color of an element to indigo-500 on hover using the hover:text-indigo-500 utilities.

  48. Use w-12 to set an element to a fixed width(3rem).

  49. Use h-10 to set an element to a fixed height(2.5rem).

  50. Use h-full to set an element’s height to 100% of its parent, as long as the parent has a defined height.

  51. Control the margin on top side of an element to 0.75rem using the mt-3 utilities.

  52. Control the margin on left side of an element to 1rem using the ml-4 utilities.

  53. Control the margin on top side of an element to 1.25rem at only medium screen sizes using the md:mt-5 utilities.

  54. Control the margin on left side of an element to 3rem at only medium screen sizes using the md:ml-12 utilities.

  55. Control the text color of an element to indigo-200 using the text-indigo-200 utilities.

  56. Use h-12 to set an element to a fixed height(3rem).

  57. Use md:w-16 to set an element to a fixed width(4rem) at only medium screen sizes.

  58. Use md:h-16 to set an element to a fixed height(4rem) at only medium screen sizes.

  59. Control the vertical padding of an element to 1.5rem using the py-6 utilities.

  60. Control the horizontal padding of an element to 4rem at only medium screen sizes using the md:px-16 utilities.

  61. Control the vertical padding of an element to 2.5rem at only medium screen sizes using the md:py-10 utilities.

  62. Control the text color of an element to xl using the text-xl utilities.

  63. Control the text color of an element to 2xl at only medium screen sizes using the md:text-2xl utilities.

  64. Control the vertical margin of an element to 1rem using the my-4 utilities.

  65. Control the text color of an element to center using the text-center utilities.

  66. Use inline-block utilities to wrap the element to prevent the text inside from extending beyond its parent.

  67. Control the horizontal margin of an element to 0.5rem using the mx-2 utilities.

  68. Control the background color of an element to indigo-300 using the bg-indigo-300 utilities.

  69. Control the background color of an element to indigo-600 using the bg-indigo-600 utilities.

  70. Control the text color of an element to white using the text-white utilities.

  71. Control the padding on top side of an element to 0.5rem using the pt-2 utilities.

  72. Control the padding on bottom side of an element to 1.5rem using the pb-6 utilities.

  73. Control the text color of an element to sm using the text-sm utilities.

  74. Control the text color of an element to base at only medium screen sizes using the md:text-base utilities.

  75. Control the text color of an element to gray-700 using the text-gray-700 utilities.

  76. Control the text color of an element to xs using the text-xs utilities.

  77. Control the text color of an element to sm at only medium screen sizes using the md:text-sm utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to create a Testimonial UI with TailwindCSS and AlpineJS components, learn and follow along to implement your own components.