الانتقال إلى المحتوى الرئيسي

نظرة عامة

يوفر SearchInput أيقونة بحث وإدخال نصي. يتلقى onValueChange السلسلة الجديدة؛ بينما يتلقى onChange حدث التغيير الأصلي في React. تنتمي التصفية والجلب وإزالة الارتداد إلى تطبيقك.

استخدام

استخدم aria-label أو aria-labelledby لاسم يمكن الوصول إليه. تنطبق خصائص الإدخال الأصلية وclassName وstyle وref على الإدخال نفسه. تتولى InputGroup المشتركة ملحق البحث ومعالجة التركيز. لا يقبل الغلاف الذي ينسّق الحقل وإجراءاته أي خصائص؛ ضع SearchInput في الحاوية الخاصة بك لتحديد حجمه أو موضعه. استخدم size="sm" لحقل بحث مضغوط.

الإجراءات

يعرض actions عناصر التحكم بعد حقل البحث. أنشئ نافذة منبثقة للتصفية باستخدام قائمة منسدلة يكون مشغّلها IconButton، ومنح ذلك الزر اسمًا متاحًا.
يعطّل disabled إدخال النص فقط؛ عطّل عناصر التحكم الخاصة بالإجراءات بشكل منفصل. عند استخدام size="sm"، مرّر size="sm" إلى عناصر التحكم الخاصة بالإجراءات أيضًا.

الإزاحة

ReactNode
Controls rendered after the search field, such as a filter Dropdown. Set their size and accessible names on the controls.
string
Accessible name when aria-labelledby is absent.
string
ID of the element that labels the input. Takes precedence over aria-label.
boolean
Focuses the input when mounted.
string | ((state: InputState) => string | undefined)
Class applied to the input.
string | number | readonly string[]
The default value of the input. Use when uncontrolled.
boolean
Disables the text input. Controls in actions keep their own state.
boolean
افتراضي:"false"
Shows the group focus border. Defaults to false for all search inputs. Set true to opt in. Error styling remains visible.
string
Input ID, generated when omitted.
((event: BaseUIEvent<ChangeEvent<HTMLInputElement, HTMLInputElement>>) => void)
Native input change event handler.
((value: string, eventDetails: { reason: "none"; event: Event; cancel: () => void; allowPropagation: () => void; isCanceled: boolean; isPropagationAllowed: boolean; trigger: Element | undefined; }) => void)
Called with the new text. The application owns filtering.
string
Hint shown when the input is empty. Also used as the accessible name if no explicit label is supplied.
Ref<HTMLInputElement>
Ref to the native input element.
ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, InputState>
Allows you to replace the component’s HTML element with a different tag, or compose it with another component.Accepts a ReactElement or a function that returns the element to render.
"md" | "sm"
افتراضي:"md"
Visual size of the input group.
CSSProperties | ((state: InputState) => CSSProperties | undefined)
Style applied to the element, or a function that returns a style object based on the component’s state.
"end" | "start"
Aligns text to the logical start or end of the input. Follows the text direction.
string | number | readonly string[]
Current search text.