diff --git a/.changeset/friendly-pens-sin.md b/.changeset/friendly-pens-sin.md new file mode 100644 index 0000000000..8844f8e987 --- /dev/null +++ b/.changeset/friendly-pens-sin.md @@ -0,0 +1,5 @@ +--- +"@navikt/ds-react": patch +--- + +:adhesive_bandage: Combobox: Placeholder goes away when an option is selected diff --git a/@navikt/core/react/src/form/combobox/Input/Input.tsx b/@navikt/core/react/src/form/combobox/Input/Input.tsx index 17448a8e3d..34db0ac86c 100644 --- a/@navikt/core/react/src/form/combobox/Input/Input.tsx +++ b/@navikt/core/react/src/form/combobox/Input/Input.tsx @@ -230,6 +230,7 @@ const Input = forwardRef( aria-activedescendant={activeDecendantId} aria-describedby={ariaDescribedBy} aria-invalid={inputProps["aria-invalid"]} + placeholder={selectedOptions.length ? undefined : rest.placeholder} className={cl( inputClassName, "navds-combobox__input", diff --git a/@navikt/core/react/src/form/combobox/combobox.stories.tsx b/@navikt/core/react/src/form/combobox/combobox.stories.tsx index 9baedf2948..85e9549312 100644 --- a/@navikt/core/react/src/form/combobox/combobox.stories.tsx +++ b/@navikt/core/react/src/form/combobox/combobox.stories.tsx @@ -35,7 +35,11 @@ const options = [ ]; export const Default: StoryFunction = (props) => ( - + ); Default.args = { @@ -51,6 +55,9 @@ Default.argTypes = { description: { control: { type: "text" }, }, + placeholder: { + control: { type: "text" }, + }, disabled: { control: { type: "boolean" }, },