2021-09-17 00:18:50 +08:00
---
title: Config Provider
2021-10-22 19:32:39 +08:00
lang: en-US
2021-09-17 00:18:50 +08:00
---
# Config Provider
2021-07-26 00:24:30 +08:00
2022-02-06 09:20:37 +08:00
Config Provider is used for providing global configurations, which enables your entire application to access these configurations everywhere.
2021-07-26 00:24:30 +08:00
2022-02-06 09:20:37 +08:00
## i18n Configurations
2021-07-26 00:24:30 +08:00
2022-02-06 09:20:37 +08:00
Configure i18n related properties via Config Provider, to get language switching feature.
2021-07-26 00:24:30 +08:00
:::demo Use two attributes to provide i18n related config
2021-09-17 00:18:50 +08:00
config-provider/usage
2021-07-26 00:24:30 +08:00
:::
2022-02-06 09:20:37 +08:00
## Button Configurations
2021-11-05 18:10:07 +08:00
2021-11-05 20:49:57 +08:00
:::demo
2021-11-05 18:10:07 +08:00
config-provider/button
:::
2022-02-06 09:20:37 +08:00
## Message Configurations
2022-01-08 20:03:13 +08:00
:::demo
config-provider/message
:::
2022-03-24 13:48:58 +08:00
## Experimental features
In this section, you can learn how to use Config Provider to provide experimental features. For now, we haven't added any experimental features, but in the feature roadmap, we will add some experimental features. You can use this config to manage the features you want or not.
// TODO
2021-09-17 00:18:50 +08:00
## Config Provider Attributes
2021-07-26 00:24:30 +08:00
2022-04-12 22:29:05 +08:00
| Attribute | Description | Type | Accepted Values | Default |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| locale | Locale Object | [Language ](https://github.com/element-plus/element-plus/blob/a98ff9b40c0c3d2b9959f99919bd8363e3e3c25a/packages/locale/index.ts#L5 ) | [languages ](https://github.com/element-plus/element-plus/tree/dev/packages/locale/lang ) | [English ](https://github.com/element-plus/element-plus/blob/dev/packages/locale/lang/en.ts ) |
| size | global component size | string | large / default /small | default |
| zIndex | global Initial zIndex | number | - | - |
| namespace | global component className prefix (cooperated with [$namespace ](https://github.com/element-plus/element-plus/blob/dev/packages/theme-chalk/src/mixins/config.scss#L1 )) | string | - | el |
| button | button related configuration, [see the following table ](#button-attributes ) | ButtonGlobalConfig | - | see the following table |
| message | message related configuration, [see the following table ](#message-attributes ) | MessageGlobalConfig | - | see the following table |
| experimental-features | features at experimental stage to be added, all features are default to be set to false | Object | - | - |
2021-11-05 18:10:07 +08:00
2021-11-10 09:38:05 +08:00
## Button Attributes
2021-11-05 18:10:07 +08:00
| Attribute | Description | Type | Accepted Values | Default |
| --------------- | ----------------------------------------------------------- | ------- | --------------- | ------- |
2021-11-10 15:21:20 +08:00
| autoInsertSpace | automatically insert a space between two chinese characters | boolean | - | false |
2021-10-04 08:26:51 +08:00
2022-01-08 20:03:13 +08:00
## Message Attributes
| Attribute | Description | Type | Accepted Values | Default |
| --------- | --------------------------------------------------------------------- | ------ | --------------- | ------- |
| max | the maximum number of messages that can be displayed at the same time | number | - | - |
2021-10-04 08:26:51 +08:00
## ConfigProvider Slots
2022-02-06 09:20:37 +08:00
| Name | Description | Scope |
| ---- | ------------------------- | ------------------------------------------------------- |
| - | customize default content | config: provided global config (inherited from the top) |