diff --git a/packages/eds-core-react/src/components/Input/Input.docs.mdx b/packages/eds-core-react/src/components/Input/Input.docs.mdx index db48ceaebe..7a6b20454c 100644 --- a/packages/eds-core-react/src/components/Input/Input.docs.mdx +++ b/packages/eds-core-react/src/components/Input/Input.docs.mdx @@ -63,3 +63,8 @@ Compact `Input` using `EdsProvider`. + +### Override input background color +Use custom property `--eds-input-background` to change the background color of the input field. This also works for all components using input internally: `Autocomplete`, `Textfield`, `Search` and `Textarea` + + diff --git a/packages/eds-core-react/src/components/Input/Input.stories.tsx b/packages/eds-core-react/src/components/Input/Input.stories.tsx index d45b4cc6c5..87e580f797 100644 --- a/packages/eds-core-react/src/components/Input/Input.stories.tsx +++ b/packages/eds-core-react/src/components/Input/Input.stories.tsx @@ -250,3 +250,21 @@ export const WithAdornments: Story = () => { export const casted: Story = (args) => { return } + +export const OverrideBackground: Story = (args) => { + return ( + + ) +} +OverrideBackground.decorators = [ + (Story) => { + return ( + + + + ) + }, +] diff --git a/packages/eds-core-react/src/components/Input/Input.tsx b/packages/eds-core-react/src/components/Input/Input.tsx index 42ae4f9de3..78c5217c7f 100644 --- a/packages/eds-core-react/src/components/Input/Input.tsx +++ b/packages/eds-core-react/src/components/Input/Input.tsx @@ -36,7 +36,7 @@ const Container = styled.div(({ token, disabled, readOnly }: StyledProps) => { border: none; box-sizing: border-box; box-shadow: ${token.boxShadow}; - background: ${token.background}; + background: var(--eds-input-background, ${token.background}); ${outlineTemplate(token.outline)} &:focus-within { diff --git a/packages/eds-core-react/src/components/Input/__snapshots__/Input.test.tsx.snap b/packages/eds-core-react/src/components/Input/__snapshots__/Input.test.tsx.snap index 2befe8540d..9de00ac339 100644 --- a/packages/eds-core-react/src/components/Input/__snapshots__/Input.test.tsx.snap +++ b/packages/eds-core-react/src/components/Input/__snapshots__/Input.test.tsx.snap @@ -18,7 +18,7 @@ exports[`Input Matches snapshot 1`] = ` border: none; box-sizing: border-box; box-shadow: inset 0px -1px 0px 0px var(--eds_text__static_icons__tertiary,rgba(111,111,111,1)); - background: var(--eds_ui_background__light,rgba(247,247,247,1)); + background: var(--eds-input-background,var(--eds_ui_background__light,rgba(247,247,247,1))); outline: 1px solid transparent; outline-offset: 0px; background: transparent; diff --git a/packages/eds-core-react/src/components/Search/__snapshots__/Search.test.tsx.snap b/packages/eds-core-react/src/components/Search/__snapshots__/Search.test.tsx.snap index c8ce6411f5..e7ece01e9f 100644 --- a/packages/eds-core-react/src/components/Search/__snapshots__/Search.test.tsx.snap +++ b/packages/eds-core-react/src/components/Search/__snapshots__/Search.test.tsx.snap @@ -18,7 +18,7 @@ exports[`Search Matches snapshot 1`] = ` border: none; box-sizing: border-box; box-shadow: inset 0px -1px 0px 0px var(--eds_text__static_icons__tertiary,rgba(111,111,111,1)); - background: var(--eds_ui_background__light,rgba(247,247,247,1)); + background: var(--eds-input-background,var(--eds_ui_background__light,rgba(247,247,247,1))); outline: 1px solid transparent; outline-offset: 0px; } diff --git a/packages/eds-core-react/src/components/TextField/__snapshots__/TextField.test.tsx.snap b/packages/eds-core-react/src/components/TextField/__snapshots__/TextField.test.tsx.snap index 338b2e2d8a..a29b036e40 100644 --- a/packages/eds-core-react/src/components/TextField/__snapshots__/TextField.test.tsx.snap +++ b/packages/eds-core-react/src/components/TextField/__snapshots__/TextField.test.tsx.snap @@ -49,7 +49,7 @@ exports[`TextField Matches snapshot 1`] = ` border: none; box-sizing: border-box; box-shadow: inset 0px -1px 0px 0px var(--eds_text__static_icons__tertiary,rgba(111,111,111,1)); - background: var(--eds_ui_background__light,rgba(247,247,247,1)); + background: var(--eds-input-background,var(--eds_ui_background__light,rgba(247,247,247,1))); outline: 1px solid transparent; outline-offset: 0px; }