Learn Tailwindcss in Bangla

TailwindCSS দিয়ে একটি Modal Card

PurposeClasses
Overlay backgroundfixed inset-0 bg-black bg-opacity-50
Center modalflex items-center justify-center
Modal boxbg-white p-6 rounded-lg shadow-lg
ButtonsTailwind spacing + hover colors
export default function Modal({ open, onClose }) {
  if (!open) return null;
 
  return (
    <div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center">
      <div className="bg-white p-6 rounded-lg shadow-lg w-80">
        <h2 className="text-xl font-semibold mb-4">Modal Title</h2>
        <p className="text-gray-600 mb-4">This is a simple modal content.</p>
 
        <div className="flex justify-end gap-2">
          <button 
            onClick={onClose}
            className="px-4 py-2 bg-gray-200 rounded hover:bg-gray-300"
          >
            Close
          </button>
          <button className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">
            Confirm
          </button>
        </div>
      </div>
    </div>
  );
}

© 2024 - 2026 React JS Bangla Tutorial.