ReactJS Evergreen Button Component
React Evergreen is a popular front-end library with a set of React components for building beautiful products as this library is flexible, sensible defaults, and User friendly. Button Component allows the user to take actions, and make choices, with a single tap. We can use the following approach in ReactJS to use the Evergreen Button Component.
Button Props:
- appearance: It is used to denote the appearance of the button.
- size: It is used to denote the size of the button.
- isLoading: It is used to show a loading spinner before the children when this is set to true.
- isActive: It is used to forcefully set the active state of a button.
- iconBefore: It is used to set an icon before the text.
- iconAfter: It is used to set an icon after the text.
- disabled: It is used to disable the button when this is set to true.
- className: It is used to pass the class name for the button.
IconButton Props:
- size: It is used to denote the size of the button.
- icon: It is used to denote the custom icon node or an Evergreen icon.
- iconsize: It is used to denote the icon size.
- intent: It is used to denote the intent of the button.
- appearance: It is used to denote the appearance of the button.
- isActive: It is used to forcefully set the active state of a button.
- disabled: It is used to disable the button when this is set to true.
- className: It is used to pass the class name for the button.
TextDropdownButton Props:
- isActive: It is used to forcefully set the active state of a button.
- disabled: It is used to disable the button when this is set to true.
- icon: It is used to denote the custom icon node or an Evergreen icon.
- className: It is used to pass the class name for the button.
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:
cd foldername
Step 3: After creating the ReactJS application, Install the required module using the following command:
npm install evergreen-ui
Project Structure: It will look like the following.

Project Structure
Example: Now write down the following code in the App.js file. Here, App is our default component where we have written our code.
App.js
import React from 'react' import { Button } from 'evergreen-ui' export default function App() { return ( <div style={{ display: 'block' , width: 700, paddingLeft: 30 }}> <h4>ReactJS Evergreen Button Component</h4> <Button appearance= "primary" > Primary Button </Button> <br></br> <Button appearance= "minimal" > Minimal Button </Button> <br></br> <Button>Default Button</Button> </div> ); } |
Step to Run Application: Run the application using the following command from the root directory of the project:
npm start
Output: Now open your browser and go to http://localhost:3000/, you will see the following output:
Reference: https://evergreen.segment.com/components/buttons
Please Login to comment...