Skip to main content

ProProvider API

ProProvider (also exported as ProConfigProvider) is a configuration provider for all Pro components, allowing you to customize themes, internationalization, and global behaviors.

ProConfigProvider

children
React.ReactNode
required
Child components to provide configuration to.
token
DeepPartial<ProAliasToken>
Custom design tokens for theming.
dark
boolean
default:"false"
Enable dark mode.When enabled, automatically applies Ant Design’s dark algorithm to the theme.
hashed
boolean
default:"true"
Whether to use hashed CSS class names.Set to false in development for easier debugging.
prefixCls
string
default:"ant-pro"
CSS class prefix for Pro components.
intl
IntlType
Internationalization configuration.
valueTypeMap
Record<string, ProRenderFieldPropsType>
Custom value type renderers.
autoClearCache
boolean
default:"false"
Automatically clear SWR cache when component unmounts.Useful for preventing stale data in multi-tenant applications.
needDeps
boolean
default:"false"
Whether to check dependencies before rendering provider.Internal optimization prop - not typically needed by users.

useIntl Hook

Hook to access internationalization within Pro components.
import { useIntl } from '@ant-design/pro-components';

const MyComponent = () => {
  const intl = useIntl();
  
  return (
    <div>
      {intl.getMessage('app.welcome', 'Welcome')}
    </div>
  );
};

IntlType

locale
string
Current locale (e.g., ‘en-US’, ‘zh-CN’).
getMessage
function
Get internationalized message.
(id: string, defaultMessage?: string) => string

ProRenderFieldPropsType

Type for custom value type renderers.
render
function
Render function for read mode.
(text: any, props: ProFieldFCRenderProps, dom: React.JSX.Element) => React.JSX.Element
formItemRender
function
Render function for edit mode.
(text: any, props: ProFieldFCRenderProps, dom: React.JSX.Element) => React.JSX.Element

BaseProFieldFC

Base type for field components.
text
React.ReactNode
Value to display.
mode
'read' | 'edit' | 'update'
Render mode.
fieldProps
any
Props for the underlying component.
light
boolean
Light mode (compact).
label
React.ReactNode
Field label.
valueEnum
Record<string, any> | Map<string, any>
Value enumeration.
proFieldKey
React.Key
Unique key for the field.

ProSchemaValueEnumType

Type for value enum items.
type ProSchemaValueEnumType = {
  text: React.ReactNode;
  status?: string;
  color?: string;
  disabled?: boolean;
}
text
React.ReactNode
required
Display text.
status
string
Predefined status color.Options: Success, Processing, Default, Error, Warning
color
string
Custom color (overrides status).
disabled
boolean
Whether the option is disabled.

Usage Examples

import { ProConfigProvider } from '@ant-design/pro-components';
import { ConfigProvider } from 'antd';
import enUS from 'antd/es/locale/en_US';

export default () => (
  <ConfigProvider locale={enUS}>
    <ProConfigProvider>
      <App />
    </ProConfigProvider>
  </ConfigProvider>
);

Best Practices

  1. Place at root: Put ProConfigProvider at the root of your application, wrapping all Pro components.
  2. Combine with ConfigProvider: Use together with Ant Design’s ConfigProvider for consistent theming.
  3. Theme tokens: Customize token prop to match your brand colors and spacing.
  4. Dark mode: Use the dark prop to toggle dark mode - it automatically applies the correct theme algorithm.
  5. Custom value types: Register custom value types via valueTypeMap to reuse across all Pro components.
  6. Internationalization: Provide intl configuration for multi-language support.
  7. Performance: Enable autoClearCache in multi-tenant apps to prevent data leakage between tenants.

Build docs developers (and LLMs) love