Open In App

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 Reactstrap Card Component.

Properties of the ReactStrap props:



Card Props:

CardBody Props:



 

CardColumns Props:

Card deck Props:

CardFooter Props:

CardGroup Props:

CardHeader Props:

CardImg Props:

CardImgOverlay Props:

 

CardLink Props:

CardSubtitle Props:

CardText Props:

CardTitle Props :

The syntax for Creating React Application And Installing Modules:

 npm install --save reactstrap react react-dom

Project Structure: It will look like the following :

Project Structure

Example 1: Now write down the following code in the App.js file. Here, the App is our default component where we have written our code.




import React from 'react'
import 'bootstrap/dist/css/bootstrap.min.css';
import {
    Card, CardImg, CardBody,
    CardTitle, CardText, Button
} from "reactstrap"
  
function App() {
    return (
        <div style={{
            display: 'block', width: 700, padding: 30
        }}>
            <h4>ReactJS Reactstrap Card Component</h4>
            <Card>
                <CardImg
                    width="50px"
                    height="50px"
                src="https://media.geeksforgeeks.org/wp-content/
                          uploads/20210425000233/test-300x297.png"
                    alt="GFG Logo" />
                <CardBody>
                    <CardTitle tag="h5">Sample Card title</CardTitle>
                    <CardText>Sample Card Text to display!</CardText>
                    <Button>Action Button</Button>
                </CardBody>
            </Card>
        </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:

Card Component

Example 2:This is another example for ReactStrap card component. 




import React from "react";
import {
  Card,CardBody,CardLink,CardTitle,
     
} from "reactstrap";
  
const Example = (props) => {
  return (
    <div>
      <Card>
        <CardBody>
          <CardTitle tag="h5">GFG Practice Portal </CardTitle>
          <img
          width="50%"
               uploads/20210728115525/imggggg.png"
          alt="Card image cap"
        />
           
            
         <p>
            The Best Data Structures Course Available Online From Skilled 
            And Experienced Faculty. Learn Data Structures In A Live 
            Classroom With The Best Of Faculty In The Industry. 
            Classroom Experience.
          </p>
  
        </CardBody>
         
        <CardBody>
           
          <CardLink href="https://www.geeksforgeeks.org/html-images/amp/">
             To knbow more about us... 
          </CardLink>
   
        </CardBody>
      </Card>
    </div>
  );
};
  
export default Example;

card components 


Article Tags :