From 2c7ea6362a96d756dd06ff8fe273549fbd405536 Mon Sep 17 00:00:00 2001 From: Said Akhrarov <36972061+akhrarovsaid@users.noreply.github.com> Date: Tue, 19 Nov 2024 12:55:26 -0500 Subject: [PATCH] fix(ui): show required indicator for select fields (#9348) ### What? Select field was not showing required indicator despite being marked required in config. ### Why? To give end-user feedback when editting required select fields. ### How? Replacing hardcoded required prop with required prop passed in from config. [See here.](https://github.com/payloadcms/payload/blob/main/packages/ui/src/fields/Select/Input.tsx#L100) --- packages/ui/src/fields/Select/Input.tsx | 6 +++++- packages/ui/src/fields/Select/index.tsx | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/fields/Select/Input.tsx b/packages/ui/src/fields/Select/Input.tsx index 149656865..edb160baf 100644 --- a/packages/ui/src/fields/Select/Input.tsx +++ b/packages/ui/src/fields/Select/Input.tsx @@ -33,6 +33,7 @@ export type SelectInputProps = { readonly options?: OptionObject[] readonly path: string readonly readOnly?: boolean + readonly required?: boolean readonly showError?: boolean readonly style?: React.CSSProperties readonly value?: string | string[] @@ -56,6 +57,7 @@ export const SelectInput: React.FC = (props) => { options, path, readOnly, + required, showError, style, value, @@ -97,7 +99,9 @@ export const SelectInput: React.FC = (props) => { > } + Fallback={ + + } />
{ options={options} path={path} readOnly={readOnly} + required={required} showError={showError} style={styles} value={value as string | string[]}