ant-design/components/button/demo/custom-disabled-bg.tsx
Ryan ec3b479076
feat: Customize background colors of default & dashed buttons in disabled state (#52839)
* feat: Supports customizing the background color of default type buttons in disabled state

* test: add corresponding test case

* feat: Supports customizing the background color of dashed type buttons in disabled state

* test: add corresponding test case

* chore: add custom disabled backgroundColor demo

* chore: add snapshot

* chore: add whitespace

* chore: Modify the variable name of the button token

* test: update test

* chore: update snapshot

* chore: update snapshot

* Update components/button/style/token.ts

docs: update comments

Co-authored-by: thinkasany <480968828@qq.com>
Signed-off-by: Ryan <55972954+yellowryan@users.noreply.github.com>

---------

Signed-off-by: Ryan <55972954+yellowryan@users.noreply.github.com>
Co-authored-by: thinkasany <480968828@qq.com>
2025-03-13 15:28:42 +08:00

28 lines
609 B
TypeScript

import React from 'react';
import { Button, Flex, ConfigProvider } from 'antd';
const App: React.FC = () => (
<Flex gap="small" wrap>
<ConfigProvider
theme={{
components: {
Button: {
defaultBgDisabled: 'rgba(0,0,0,0.1)',
dashedBgDisabled: 'rgba(0,0,0,0.4)',
},
},
}}
>
<Button type="primary" disabled>
Primary Button
</Button>
<Button disabled>Default Button</Button>
<Button type="dashed" disabled>
Dashed Button
</Button>
</ConfigProvider>
</Flex>
);
export default App;