---
order: 5
version: 4.17.0
title:
zh-CN: 全局样式
en-US: Global Theme
---
## zh-CN
通过 css variable 修改全局主题色(你可以切换到组件页面查看更详细的样式展示),不支持 IE。自动生成的变量可能会根据设计调整,请勿直接依赖。详细配置请[点击查看](/docs/react/customize-theme-variable)。
## en-US
Modify global theme color by css variable which IE not support. Css variable depends on the design, it may adjust so please do not directly use it. You can go to other components page for more detail style. [Check this](/docs/react/customize-theme-variable) to view detail.
```jsx
import { SketchPicker } from 'react-color';
import React, { useState } from 'react';
import {
DownOutlined,
MailOutlined,
SettingOutlined,
ClockCircleOutlined,
} from '@ant-design/icons';
import {
ConfigProvider,
Tag,
Mentions,
Steps,
Button,
Radio,
Space,
Form,
Input,
Row,
Col,
Typography,
Menu,
Dropdown,
Divider,
Pagination,
Select,
Checkbox,
DatePicker,
TimePicker,
InputNumber,
Slider,
Switch,
TreeSelect,
Card,
Table,
Tabs,
Timeline,
Tree,
Alert,
Progress,
Spin,
Transfer,
} from 'antd';
const SplitSpace = props => } size={4} {...props} />;
const inputProps = {
style: { width: 128 },
};
const selectProps = {
...inputProps,
options: [
{ value: 'light', label: 'Light' },
{ value: 'bamboo', label: 'Bamboo' },
{ value: 'little', label: 'Little' },
],
};
const treeData = [
{
value: 'little',
key: 'little',
label: 'Little',
title: 'Little',
children: [
{ value: 'light', key: 'light', label: 'Light', title: 'Light' },
{ value: 'bamboo', key: 'bamboo', label: 'Bamboo', title: 'Bamboo' },
],
},
];
const treeSelectProps = {
...inputProps,
treeCheckable: true,
maxTagCount: 'responsive',
treeData,
};
const carTabListNoTitle = [
{
key: 'article',
tab: 'article',
},
{
key: 'app',
tab: 'app',
},
{
key: 'project',
tab: 'project',
},
];
const MyTransfer = () => {
const mockData = [];
for (let i = 0; i < 20; i++) {
mockData.push({
key: i.toString(),
title: `content${i + 1}`,
description: `description of content${i + 1}`,
});
}
return (
item.title}
/>
);
};
const FormSizeDemo = () => {
const [color, setColor] = useState({
primaryColor: '#1890ff',
errorColor: '#ff4d4f',
warningColor: '#faad14',
successColor: '#52c41a',
infoColor: '#1890ff',
});
function onColorChange(nextColor) {
const mergedNextColor = {
...color,
...nextColor,
};
setColor(mergedNextColor);
ConfigProvider.config({
theme: mergedNextColor,
});
}
return (
{/* Primary Color */}
{
onColorChange({
primaryColor: hex,
});
}}
/>
var(`--ant-primary-color`)
{/* Error Color */}
{
onColorChange({
errorColor: hex,
});
}}
/>
var(`--ant-error-color`)
{/* Warning Color */}
{
onColorChange({
warningColor: hex,
});
}}
/>
var(`--ant-warning-color`)
{/* Success Color */}
{
onColorChange({
successColor: hex,
});
}}
/>
var(`--ant-success-color`)
{/* Info Color */}
{
onColorChange({
infoColor: hex,
});
}}
/>
var(`--ant-info-color`)
} style={{ width: '100%' }} size={0}>
{/* Primary Button */}
Primary
Default
Dashed
Text
Link
{/* Danger Button */}
Primary
Default
Dashed
Text
Link
{/* Ghost Button */}
Primary
Default
Dashed
Primary
Default
Dashed
{/* Typography */}
Text (success)
Text(warning)
Text(danger)
Link
Text
{/* Dropdown */}
1st menu item
a danger item
}
>
e.preventDefault()}>
Hover me
{/* Spin */}
{/* Menu - horizontal */}
}>
Mail
} title="Submenu">
Option 1
Option 2
}>
Mail
} title="Submenu">
Option 1
Option 2
{/* Menu - vertical */}
}>
Mail
} title="Submenu">
Option 1
Option 2
}>
Mail
} title="Submenu">
Option 1
Option 2
{/* Pagination */}
{/* Steps */}
{/* Steps - dot */}
{/* Form - Input */}
{/* Form - Select */}
{/* Form - TreeSelect */}
{/* Form - InputNumber */}
{/* Form - DatePicker */}
Checkbox
Bamboo
Light
Little
afc163
zombieJ
yesmeck
{/* Card */}
More}
/>
{/* Table */}
a.key.length - b.key.length,
},
]}
dataSource={[
{
key: 'Bamboo',
},
{
key: 'Light',
},
{
key: 'Little',
},
]}
/>
{/* Table */}
Content of Tab Pane 1
Content of Tab Pane 2
Content of Tab Pane 3
success
processing
error
warning
default
CheckableTag
Create a services site 2015-09-01
Solve initial network problems 2015-09-01
}>
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium
doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore
veritatis et quasi architecto beatae vitae dicta sunt explicabo.
{/* Alert */}
{/* Progress */}
);
};
export default () => ;
```