Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • NextJS
  • Material UI
  • React Bootstrap
  • React Suite
  • Ant Design
  • Reactstrap
  • BlueprintJS
  • React Desktop
  • React Native
  • React Rebass
  • React Spring
  • React Evergreen
  • ReactJS
  • ReactJS
  • JS Formatter
  • Web Technology
Open In App
Next Article:
ReactJS Reactstrap Card Component
Next article icon

ReactJS Reactstrap Button Component

Last Updated : 07 Mar, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. The Button component allows the user to take action, and make choices, with a single tap. We can use the following approach in ReactJS to use the ReactJS Reactstrap Button Component.

Buttons props:

  • active: The active props in the Reactstrap are used to manually set the button into an active state.
  • aria-label: This aria-label prop is used to denote the string that flags the current element. It is used where the screen is not visible.
  • block: The button props are used to indicate whether the button should have a block style or not.
  • color: The color props in the reactStrap are used to set the color of the element in the component.
  • disabled: The disabled props are used to set disabled-buttons.It transfers the button into an inactive state.
  • outline: The outline props are used to indicate whether the button should have an outline style or not.
  • innerRef: This prop is used to denote the inner reference of the element. The innerRef is a custom property that is used by the developers in the project.
  • onClick: The onClick property is invoked when the callback function is fired and a button is clicked.
  • size: These props are used to specify the size of the button
  • cssModule: This button prop is used to denote the CSS module for styling the component.

Syntax For Creating React Application And Installing Modules:

Step 1: Create a React application using the following command:

npx create-react-app foldername

Step 2: After creating your project folder i.e. folder name, 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 reactstrap bootstrap

Project Structure: It will look like the following.

Project Structure

Example 1: Now write down the following code in the App.js file. Here, here we have shown buttons without a disabled state.

Filename: App.js

JavaScript
import React from 'react' import 'bootstrap/dist/css/bootstrap.min.css'; import { Button } from "reactstrap"  function App() {     return (         <div style={{             display: 'block', width: 700, padding: 30         }}>             <h4>ReactJS Reactstrap Button Component</h4>             <Button color="success">Success Color Button</Button> <br></br>             <Button color="danger">Danger Color Button</Button> <br></br>             <Button color="warning">Warning Color Button</Button> <br></br>             <Button color="primary">Primary Color Button</Button> <br></br>             <Button color="secondary">Secondary Color Button</Button> <br></br>             <Button color="info">Info Color Button</Button> <br></br>             <Button color="link">Link Color Button</Button>         </div>     ); }  export default App; 

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:

Example 2: Now write down the following code in the App.js file. Here, here we have shown buttons with the disabled states.

Filename: App.js

JavaScript
import React from 'react' import 'bootstrap/dist/css/bootstrap.min.css'; import { Button } from "reactstrap"  function App() {     return (         <div style={{             display: 'block', width: 700, padding: 30         }}>             <h4>ReactJS Reactstrap Button Component</h4>             <Button color="success"                 disabled>Disabled Success Color Button</Button> <br></br>             <Button color="danger"                 disabled>Disabled Danger Color Button</Button> <br></br>             <Button color="info"                 disabled>Disabled Info Color Button</Button> <br></br>             <Button color="link"                 disabled>Disabled Link Color Button</Button>         </div>     ); }  export default App; 

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:


 


Next Article
ReactJS Reactstrap Card Component
author
gouravhammad
Improve
Article Tags :
  • JavaScript
  • Web Technologies
  • ReactJS
  • Reactstrap

Similar Reads

  • ReactJS Reactstrap ButtonGroup Component
    Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. ButtonGroup component is used to group related buttons together. This component is used when the user needs to show the buttons together a
    3 min read
  • ReactJS Reactstrap ButtonDropdown Component
    Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. The ButtonDropdown component is used to render a group or split button dropdown bootstrap component. We can use the following approach in
    3 min read
  • ReactJS Reactstrap Alert Component
    Reactstrap: Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. The alert Component is used for urgent interruptions, requiring acknowledgment that informs the user about a situation. We can
    2 min read
  • ReactJS Reactstrap Badges Component
    Reactstrap is a bootstrap-based react UI library that is used to make good-looking webpages with its seamless and easy-to-use component. In this article we will know how to use Badges Component in Reactstrap. Badges are used for creating labels. Badges scale to match the size of the immediate parent
    2 min read
  • ReactJS Reactstrap Card Component
    Reactstrap: Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. The Card components allow the user to display content. We can use the following approach in ReactJS to use the ReactJS Reactst
    5 min read
  • React Rebass Button Component
    React Rebass is a front-end framework that was designed keeping react in mind. In this article, we will see how to use Button Component in React Rebass. The button is an important component that is required in each development. So to create a button component, we can import the Rebass Button compone
    2 min read
  • ReactJS Reactstrap Tab Component
    Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. The Tab component allows the user to switch between components present in given different tabs. We can use the following approach in React
    3 min read
  • ReactJS Reactstrap Nav Component
    Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. The Nav component allows the user to provide a list of various forms of navigation menus. We can use the following approach in ReactJS to
    3 min read
  • ReactJS Reactstrap Collapse Component
    Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. The Collapse component is used as a content area that can be collapsed and expanded. We can use the following approach in ReactJS to use t
    3 min read
  • ReactJS Reactstrap Form Component
    Reactstrap is a popular front-end library that is easy to use React Bootstrap 4 components. This library contains the stateless React components for Bootstrap 4. The Form component is used when the user needs to create an instance or collect information. We can use the following approach in ReactJS
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences