Skip to content

Input: Design System theme overrides Ant theme properties #775

@fedepini

Description

@fedepini

The feature or bug you are proposing

Currently, when using an Ant Design Input component in a React application where both Ant Design and the Design System coexist, the Design System's generated theme overrides some properties of the Ant Design theme.

Although Input is used as an example here, this issue applies to any Design System component that wraps Ant Design components.

The description of the bug or the rationale of your proposal

The ThemeProvider component wraps an AntThemeProvider component, which uses a function called generateAntTheme to generate a configuration for Ant Design based on an existing theme. This function allows for mapping component tokens to specific components.

For instance, in the Input component, the paddingBlock and paddingInline tokens are overridden and set to specific values to align with the Design System's Input component. While this works correctly when using only the Design System's Input component, it causes display issues when an Ant Design Input component is added to a page. Its padding values are overridden by the theme tokens, which affects the component's height and layout.

Below is a screenshot showing two Input components — one from the Design System and the other from Ant Design — illustrating how the paddingBlock and paddingInline properties impact the component height when overridden:

image

If the tokens are not set, the two components are correctly displayed:

image

In general, when creating a component that wraps Ant Design components, we should always check the effect of our theme on the Ant component.

The expected result for your bug

Design System theme should not override Ant theme.

Your environment

node:
v20.18.0
os:
Ubuntu 20.04.6 LTS

Metadata

Metadata

Assignees

Labels

Input componentInput component and hooks related activitiesbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions