قائمة منسدلة

Dropdown

حقل قائمة منسدلة في React باختيار مفرد ومتعدّد، وبحث داخل اللوحة، وخيارات مجمّعة، وربط كامل للحقل. مبني على cmdk للتصفية السريعة بالعربية والإنجليزية.

Dropdown حقل اختيار يتركب من عناصر DropdownItem. أضف multiple للتحديد المتعدد أو searchable لمرشح داخل اللوحة.

متى تستخدمه

استخدم Dropdown حين يحتاج حقل الاختيار إلى بحث أو قيم متعدّدة أو خيارات مجمّعة: اختيار عدّة خدمات، أو التصفية حسب مدن كثيرة، أو الانتقاء من قائمة مرجعية طويلة. استخدم Select للاختيار المفرد البسيط وChip لمجموعة مرشّحات ظاهرة.

وفّر emptyMessage ليبقى البحث بلا نتائج مفهومًا.

أمثلة

اختيار مفرد

قابل للبحث

اختيار متعدّد

خيارات مجمّعة

الخصائص

الخصائص التي يعرّفها Dropdown. سمات العنصر الأصلي تمرّ كما هي.

<Dropdown>

الخاصيةالنوعالافتراضيالوصف
size"md" | "lg"
variant"default" | "filled-lighter" | "filled-darker"
openboolean
defaultOpenboolean
onOpenChange(open: boolean) => void
labelreact.ReactNodeVisible label above the trigger.
helperTextreact.ReactNodeHint shown below the trigger when there's no error.
errorMessagereact.ReactNodeMessage shown below the trigger when error is true.
errorbooleanMarks the field invalid - sets aria-invalid and the error border.
requiredbooleanAdds the required asterisk + aria-required.
disabledbooleanDisables the trigger entirely.
readOnlybooleanShows the value but blocks opening (SDGA Read-only).
placeholderreact.ReactNodePlaceholder shown when nothing is selected.
searchablebooleanRender the in-panel filter input (combobox behavior). Off by default - the plain SDGA dropdown. A hidden focusable input is kept either way for cmdk's keyboard model.
searchPlaceholderstringPlaceholder for the filter input when searchable.
emptyMessagereact.ReactNodeShown when a filter matches nothing.
getLabel(value: string) => ReactNodeOverride the trigger label resolver (e.g. async-loaded options).
idstring
classNamestring
aria-labelstring
aria-labelledbystring
childrenإلزاميreact.ReactNode<DropdownItem> (+ optional DropdownGroup / DropdownSeparator).
multiplefalse
valuestring
defaultValuestring
onValueChange(value: string) => void

<DropdownItem>

الخاصيةالنوعالافتراضيالوصف
valueإلزاميstringStable value for filtering + selection.
keywordsstring[]Extra search terms cmdk matches against the filter input.
disabledbooleanWhether this item is currently disabled.
onSelect(value: string) => voidFires alongside the root's onValueChange.
childrenReactNode
asChildboolean
forceMountbooleanWhether this item is forcibly rendered regardless of filtering.

<DropdownGroup>

الخاصيةالنوعالافتراضيالوصف
headingreact.ReactNodeOptional heading to render for this group.
childrenReactNode
asChildboolean
valuestringIf no heading is provided, you must provide a value that is unique for this group.
forceMountbooleanWhether this group is forcibly rendered regardless of filtering.

<DropdownSeparator>

الخاصيةالنوعالافتراضيالوصف
asChildboolean
alwaysRenderbooleanWhether this separator should always be rendered. Useful if you disable automatic filtering.

إمكانية الوصول

يعرض المشغّل aria-haspopup، وتستخدم تسمية الحقل والنص المساعد والخطأ الربط نفسه في TextInput. داخل اللوحة يتّبع حقل البحث وقائمة الخيارات نمط combobox من cmdk: مفاتيح الأسهم تتنقّل بين الخيارات، وEnter يبدّل الخيار المظلّل، وEscape يغلق.

تُعلن القيم المختارة، وفي وضع الاختيار المتعدّد يبقى كل اختيار ظاهرًا في المشغّل.