ant-design icon indicating copy to clipboard operation
ant-design copied to clipboard

5.0 Component Token Request

Open MadCcc opened this issue 2 years ago • 10 comments

In 5.0 and later versions, we provide component token for users to customize component style more easily. However, considering the risk of breaking change, we will add component tokens which are necessary for theming little by little.

Any request of component token is welcomed to discuss here. We will make it better in later versions.

MadCcc avatar Nov 25 '22 02:11 MadCcc

Exposing all available tokens to the ConfigProvider looks like a must. I am trying to change the height of the Layout.Header. There is a layoutHeaderHeight token but it is internal. I couldn't find a way to override it. I was about to open an issue thinking I am the one who is missing something. But it looks like they are not exported.

Is there any specific reason for not exposing all available tokens? If I can't customize the parts of my application via Javascript, what was the point of replacing less with css-in-js in the first place?


Same for the boxShadow too, I am trying to disable box shadows from buttons. There is already a boxShadow token but it has no effect. I am not sure why. Is this an expected behavior or should I open an issue for it?

Thanks for the great work on v5.

alioguzhan avatar Nov 25 '22 16:11 alioguzhan

I agree with @alioguzhan: why aren't all available tokens exposed? We are upgrading ffrom v4 and Modal for example has no component tokens exposed.

vsosinga avatar Dec 05 '22 12:12 vsosinga

Also, can we pin this issue so everyone can see it and comment ? @MadCcc

alioguzhan avatar Dec 05 '22 12:12 alioguzhan

I agree with @alioguzhan: why aren't all available tokens exposed? We are upgrading ffrom v4 and Modal for example has no component tokens exposed.

Because in V5's Design Token system, less token is needed for theming.

MadCcc avatar Dec 13 '22 04:12 MadCcc

What's the conclusion? Is exporting all tokens in a roadmap? If not, what's the recommended way to customise components.

Kamahl19 avatar Jan 24 '23 01:01 Kamahl19

I have a similar problem, colorBgLayoutHeader token not working to change Header background color. In v4 I could override ant-layout-header in LESS. Seems there isn't a working equivalent to achieve this in the new token system

osumoclement avatar Feb 06 '23 12:02 osumoclement

Please export all tokens. This would make it very easy to upgrade from v4. Our initial attempt at upgrading was a failure due to various styles which were not exported. Thanks for creating antd.

Abhirup-99 avatar Feb 18 '23 19:02 Abhirup-99

👍 what is the recommended way to achieve the following with V5?

@import "~antd/dist/antd.less";

@layout-header-height: 85px;
@layout-header-background: #fff;
@layout-header-color: #000;

dan-turner avatar Feb 20 '23 00:02 dan-turner

It would be nice if I could change the horizontal padding on table cells, titles and footers. As it stands, the only way is by changing padding, but that also changes the vertical padding.

jeffmarshall avatar Feb 20 '23 21:02 jeffmarshall

👍 what is the recommended way to achieve the following with V5?

@Wxh16144 are you able to please advise?

dan-turner avatar Mar 06 '23 08:03 dan-turner

Developers of antd, please tweak fontSize token for Typography component separately- now the only way to set font size for it is to set seed token for all components, but it doesn't fit my project

evgeniyworkbel avatar Mar 15 '23 12:03 evgeniyworkbel

@evgeniyworkbel can't you use the component token in this case? For example (haven't tested it): components: { Typography: { fontSize: '16px', } }

vsosinga avatar Mar 15 '23 19:03 vsosinga

are you able to please advise?

@dan-turner I’m sorry I didn’t get back to you sooner, but in v4 you can only adjust your theme by modifying the less variable. docs: https://4x.ant.design/docs/react/customize-theme#Ant-Design-Less-variables

Wxh16144 avatar Mar 15 '23 20:03 Wxh16144

@evgeniyworkbel can't you use the component token in this case? For example (haven't tested it): components: { Typography: { fontSize: '16px', } }

I want to apply this way, but it doesn't work

evgeniyworkbel avatar Mar 15 '23 22:03 evgeniyworkbel

Also it will be cool if antd developers are going to add token which tweak background color and border color when component Select is hovered. By the way, colorPrimaryHover token doesn't work on component Select

evgeniyworkbel avatar Mar 15 '23 22:03 evgeniyworkbel

Design token requests: font-size, font-weight and line-height for <Card title="" /> and <Card.Meta title=""/>.

guoyunhe avatar Mar 16 '23 06:03 guoyunhe

The theme.conmponets.Menu configuration of the ConfigProvider component does not take effect on the menu inside the dropdown.

demo:https://codesandbox.io/s/agitated-swanson-1gk412?file=/src/App.tsx:211-224

kangsunlei avatar Mar 20 '23 03:03 kangsunlei

It's going to be convenient if developers can be able to specify sizeable tokens like fontSize, headingFontSize, margin, padding ant etc. in relative units like rem, em and so on - for adaptiveness. Now it's uncomfortable use only a number in these tokens.

Now these size may being specifying in rem, but i found troubles with built-in components: at devtools some css properties were invalid (for example lineHeight, height)

evgeniyworkbel avatar Mar 27 '23 13:03 evgeniyworkbel

This is particularly bad for the Table component where the same color "colorFillAlter" is used for five different backgrounds:

  • table header (tableHeaderBg)
  • table footer (tableFooterBg)
  • Sorted column (tableBodySortBg)
  • Hover row (tableRowHoverBg)
  • Expanded table row (tableExpandedRowBg)

I can't set the column header color differently to make it stand out and match branding (pink) as it applies to all of those backgrounds as well:

PinkColumnHeader

(I also think they should perhaps not be the same color in the base style)

TitianMichael avatar Mar 29 '23 12:03 TitianMichael

Add tokens for TimePicker in next changelog (minor version)! PLEASE! There is nothing to manipulate it

evgeniyworkbel avatar Apr 02 '23 09:04 evgeniyworkbel

This is particularly bad for the Table component where the same color "colorFillAlter" is used for five different backgrounds:

  • table header (tableHeaderBg)
  • table footer (tableFooterBg)
  • Sorted column (tableBodySortBg)
  • Hover row (tableRowHoverBg)
  • Expanded table row (tableExpandedRowBg)

I can't set the column header color differently to make it stand out and match branding (pink) as it applies to all of those backgrounds as well:

I am facing the same issue. It's not possible to just change the header color without affecting anything else.

felixschorer avatar Apr 03 '23 12:04 felixschorer

Can we have closeIcon and selectArrowIcon to be able to configure it? @zombieJ

It is useful for Modal, Select ant other closable and selectable components

god-of-javascript avatar Apr 05 '23 20:04 god-of-javascript

Could you create developer stories for TimePicker, Tooltip, Popover in Theme Editor?

evgeniyworkbel avatar Apr 06 '23 08:04 evgeniyworkbel

On the topic of customizing internal tokens, I am currently having a difficult time with Collapse tokens related to header padding. While I understand how to change, say, collapseHeaderPaddingSM by adjusting paddingXS and paddingSM, those variables map to other padding properties that I do not want to affect the same way.

Exposing these tokens to be customizable seems like it would instantly resolve this issue.

In case I happen to be going about this the wrong way, here is how I am attempting to achieve an "inline" Collapse with no padding other than 16px between the header and content:

<ConfigProvider
            theme={{
                components: {
                    Collapse: {
                        paddingSM: 0,
                        paddingXS: 0,
                        collapseHeaderPaddingSM: '16px 0px', // TS Error
                        [...other styling not related to padding}
                    },
                },
            }}
        >
        <Collapse
                ghost
                size='small'
                {...restProps}
            >
                {children}
        </Collapse>
</ConfigProvider>

tomekregulski avatar Apr 12 '23 14:04 tomekregulski

I saw many tokens in the style library of antd's table, but many of them are not exposed and are still calculated through other exposed tokens for color. I hope to expose more tokens as much as possible to facilitate more fine-grained customization of themes, similar to how MUI exposes CSS class names for css-in-js related operations under its official website.

EmberCCC avatar Apr 14 '23 02:04 EmberCCC

Would be great to have multiple modal effects, something like: https://mantine.dev/core/transition/

vitalijalbu avatar Apr 14 '23 13:04 vitalijalbu

a new navigation sidebar & a double one:

Would be great to have multiple modal effects, something like: mantine.dev/core/transition

@vitalijalbu this issue is not for components requests, but for components token requests

Token allows to customize theme for specific components, see https://ant.design/docs/react/customize-theme

abenhamdine avatar Apr 14 '23 13:04 abenhamdine

a new navigation sidebar & a double one:

Would be great to have multiple modal effects, something like: mantine.dev/core/transition

@vitalijalbu this issue is not for components requests, but for components token requests

Token allows to customize theme for specific components, see https://ant.design/docs/react/customize-theme

ok sorry, for component tokens would be great have sizes globally on all provider, antd default is very small... like inputs, buttons etc...

vitalijalbu avatar Apr 14 '23 13:04 vitalijalbu

Similar to another typography request, I'd like to set fontFamily for Title only. Currently I'm creating a global style for h1, h2, etc. but it would be nice to have it as part of the token overrides.

freejosh avatar Apr 14 '23 21:04 freejosh