📋 محتويات الصفحة
📖 الوصف
Headless UI هي مكتبة مكونات من فريق Tailwind CSS توفر مكونات تفاعلية بدون تنسيق مسبق. توفر behavior و accessibility كامل مع حرية كاملة في التنسيق. مصممة لتعمل بشكل مثالي مع Tailwind CSS. توفر مكونات مثل Dialog, Dropdown Menu, Tabs, Modal، وأكثر. كلها accessible وتعمل مع keyboard navigation.
🎯 يستخدم في
مجالات استخدام هذه الأداة
Tailwind CSS projects
Custom design systems
Applications تحتاج accessibility
Build your own component library
Projects تحتاج unstyled components
✨ المميزات
أبرز مميزات هذه الأداة
Unstyled components
Accessible مدمج
Keyboard navigation
مصممة لـ Tailwind CSS
Lightweight
React و Vue support
TypeScript support
Works مع أي CSS framework
⚠️ العيوب
نقاط يجب مراعاتها
لا تنسيق مسبق
يحتاج تنسيق من تلقاء نفسك
أقل components من مكتبات كاملة
غير مناسبة لمن يريد حلول جاهزة
Documentation محدودة مقارنة بـ Radix
🔄 البدائل
أدوات بديلة يمكنك استخدامها
💻 مثال على الاستخدام
كيفية استخدام هذه الأداة
import { Dialog } from '@headlessui/react';
import { Fragment, useState } from 'react';
function MyDialog() {
const [isOpen, setIsOpen] = useState(false);
return (
<>
<button
onClick={() => setIsOpen(true)}
className="px-4 py-2 bg-blue-500 text-white rounded"
>
افتح الحوار
</button>
<Dialog open={isOpen} onClose={() => setIsOpen(false)}>
<Dialog.Panel className="fixed inset-0 bg-black/30 flex items-center justify-center">
<Dialog.Panel className="bg-white rounded-lg p-6 max-w-md">
<Dialog.Title className="text-xl font-bold mb-4">
عنوان الحوار
</Dialog.Title>
<Dialog.Description className="text-gray-600 mb-6">
محتوى الحوار هنا
</Dialog.Description>
<button
onClick={() => setIsOpen(false)}
className="px-4 py-2 bg-blue-500 text-white rounded"
>
إغلاق
</button>
</Dialog.Panel>
</Dialog.Panel>
</Dialog>
</>
);
}
// Menu component
import { Menu } from '@headlessui/react';
function UserMenu() {
return (
<Menu as="div" className="relative">
<Menu.Button className="px-4 py-2 bg-gray-100 rounded">
المزيد
</Menu.Button>
<Menu.Items className="absolute right-0 mt-2 w-48 bg-white rounded shadow-lg">
<Menu.Item>
{({ active }) => (
<button className={`${active ? 'bg-blue-500 text-white' : 'text-gray-900'} block w-full px-4 py-2 text-right`}>
الملف الشخصي
</button>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<button className={`${active ? 'bg-blue-500 text-white' : 'text-gray-900'} block w-full px-4 py-2 text-right`}>
الإعدادات
</button>
)}
</Menu.Item>
</Menu.Items>
</Menu>
);
}
📚 أدوات أخرى في UI-Libraries
قد يعجبك أيضاً
Ant Design
⭐مكتبة مكونات Enterprise (Enterprise UI Component Library)
Ant Design
⭐مكتبة مكونات Enterprise (Enterprise UI Component Library)
Ark UI
مكتبة مكونات Headless (Headless UI Component Library)
Ark UI
مكتبة مكونات Headless (Headless UI Component Library)
Base UI
مكتبة مكونات headless من MUI (Headless UI Components from MUI)
Base UI
مكتبة مكونات headless من MUI (Headless UI Components from MUI)