From 9256a7f23418a5fbfe66009580f00fe4182267ba Mon Sep 17 00:00:00 2001 From: martmull Date: Thu, 26 Jun 2025 14:31:51 +0200 Subject: [PATCH] Add empty option to select form field (#12898) ## Before New option selected, but not taken into account image ## After image --- .../form-types/components/FormSelectFieldInput.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx index fc698308e..4c972a3f3 100644 --- a/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx +++ b/packages/twenty-front/src/modules/object-record/record-field/form-types/components/FormSelectFieldInput.tsx @@ -15,6 +15,7 @@ import { isDefined } from 'twenty-shared/utils'; import { SelectOption } from 'twenty-ui/input'; import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth'; import { useTheme } from '@emotion/react'; +import { IconCircleOff } from 'twenty-ui/display'; type FormSelectFieldInputProps = { label?: string; @@ -93,6 +94,12 @@ export const FormSelectFieldInput = ({ (option) => option.value === draftValue.value, ); + const emptyOption = { + label: `No ${label}`, + value: '', + Icon: IconCircleOff, + }; + const handleUnlinkVariable = () => { setDraftValue({ type: 'static', @@ -132,6 +139,7 @@ export const FormSelectFieldInput = ({ options={options} value={selectedOption?.value} onChange={onSelect} + emptyOption={emptyOption} fullWidth hasRightElement={isDefined(VariablePicker) && !readonly} withSearchInput