From e45d6c47324d00d1df85f0d971a61e540db0da86 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 1 Jun 2023 11:09:58 -0400 Subject: [PATCH] also support placeholder text w/ burnettk --- .../custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx index 9fdcded30..d0a2c1222 100644 --- a/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx +++ b/spiffworkflow-frontend/src/rjsf/custom_widgets/TypeaheadWidget/TypeaheadWidget.tsx @@ -11,6 +11,7 @@ interface typeaheadArgs { disabled?: boolean; readonly?: boolean; rawErrors?: any; + placeholder?: string; } export default function TypeaheadWidget({ @@ -21,6 +22,7 @@ export default function TypeaheadWidget({ uiSchema, disabled, readonly, + placeholder, rawErrors = [], }: typeaheadArgs) { const lastSearchTerm = useRef(''); @@ -69,6 +71,11 @@ export default function TypeaheadWidget({ return str; }; + let placeholderText = `Start typing to search...`; + if (placeholder) { + placeholderText = placeholder; + } + let helperText = null; if (uiSchema && uiSchema['ui:help']) { helperText = uiSchema['ui:help']; @@ -91,7 +98,7 @@ export default function TypeaheadWidget({ id={id} items={items} itemToString={itemToString} - placeholder={`Start typing to search for ${category}...`} + placeholder={placeholderText} selectedItem={selectedItem} helperText={helperText} disabled={disabled}