<section class="p-6 bg-white rounded-lg shadow-sm">
<div class="max-w-md mx-auto space-y-6">
<!-- Disabled Textarea -->
<div class="space-y-2">
<label for="disabled-textarea" class="block text-sm font-medium text-gray-500">Disabled Textarea</label>
<textarea id="disabled-textarea" rows="4" placeholder="This textarea is disabled" disabled
class="w-full px-4 py-2 bg-gray-50 text-gray-500 border border-gray-300 rounded-md shadow-sm cursor-not-allowed"></textarea>
<p class="text-sm text-gray-500">You cannot edit this field</p>
</div>
<!-- Read Only Textarea -->
<div class="space-y-2">
<label for="readonly-textarea" class="block text-sm font-medium text-gray-700">Read Only Textarea</label>
<textarea id="readonly-textarea" rows="4" readonly
class="w-full px-4 py-2 bg-gray-50 border border-gray-300 rounded-md shadow-sm focus:outline-none">This is read-only content that cannot be modified, but you can still focus on this field and copy its contents.</textarea>
<p class="text-sm text-gray-500">You can read and copy but not edit</p>
</div>
<!-- Disabled with Text Content -->
<div class="space-y-2">
<label for="disabled-content-textarea" class="block text-sm font-medium text-gray-500">Submission Review</label>
<textarea id="disabled-content-textarea" rows="4" disabled
class="w-full px-4 py-2 bg-gray-50 text-gray-500 border border-gray-300 rounded-md shadow-sm cursor-not-allowed">Your submission has been received and is currently under review. You will be notified via email once processing is complete.</textarea>
</div>
<!-- Conditionally Disabled Textarea -->
<div class="space-y-2">
<div class="flex justify-between">
<label for="conditional-textarea" class="block text-sm font-medium text-gray-700">Additional Comments</label>
<div class="flex items-center">
<input type="checkbox" id="enable-textarea" class="w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500">
<label for="enable-textarea" class="ml-2 text-sm text-gray-700">Enable editing</label>
</div>
</div>
<textarea id="conditional-textarea" rows="4" placeholder="Check the box above to enable this textarea" disabled
class="w-full px-4 py-2 bg-gray-50 text-gray-500 border border-gray-300 rounded-md shadow-sm cursor-not-allowed transition-colors"></textarea>
</div>
</div>
<script>
// Enable/disable textarea based on checkbox
const enableCheckbox = document.getElementById('enable-textarea');
const conditionalTextarea = document.getElementById('conditional-textarea');
enableCheckbox.addEventListener('change', function() {
if (this.checked) {
conditionalTextarea.disabled = false;
conditionalTextarea.classList.remove('bg-gray-50', 'text-gray-500', 'cursor-not-allowed');
conditionalTextarea.classList.add('bg-white', 'focus:outline-none', 'focus:ring-2', 'focus:ring-blue-500', 'focus:border-blue-500');
} else {
conditionalTextarea.disabled = true;
conditionalTextarea.classList.add('bg-gray-50', 'text-gray-500', 'cursor-not-allowed');
conditionalTextarea.classList.remove('bg-white', 'focus:outline-none', 'focus:ring-2', 'focus:ring-blue-500', 'focus:border-blue-500');
}
});
</script>
</section>