ReactJS UI Ant Design ConfigProvider Component
Ant Design Library has this component pre-built, and it is very easy to integrate as well. ConfigProvider Component is used to provide uniform configuration support for components. We can use the following approach in ReactJS to use the Ant Design ConfigProvider Component.
- autoInsertSpaceInButton: When it is set to false, it removes space between 2 Chinese characters on the Button.
- componentSize: It is used to config the antd component size.
- csp: It is used to set the Content Security Policy config.
- direction: It is used to set the direction of the layout.
- dropdownMatchSelectWidth: It is used to determine whether the dropdown menu and the select input are the same widths or not.
- form: It is used to set Form common props.
- getPopupContainer: It is used to set the container of the popup element.
- getTargetContainer: It is used for the Config Affix, Anchor scroll target container.
- iconPrefixCls: It is used to set icon prefix className.
- input: It is used to set Input common props.
- locale: It is used to denote the language package setting.
- pageHeader: It is used to unify the ghost of PageHeader.
- prefixCls: It is used to set the prefix className.
- renderEmpty: It is used to set the empty content of the components.
- space: It is used to set the Space size.
- virtual: It is used to disable the virtual scroll when set it is set to false.
Creating React Application And Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app foldername
Step 2: After creating your project folder i.e. foldername, move to it using the following command:
Step 3: After creating the ReactJS application, Install the required module using the following command:
npm install antd
Project Structure: It will look like the following.
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
Step to Run Application: Run the application using the following command from the root directory of the project:
Output: Now open your browser and go to http://localhost:3000/, you will see the following output: