0

I am trying to display these bootstrap panels from here https://www.w3schools.com/bootstrap/bootstrap_panels.asp : the header and footer one.

I have installed bootstrap in my project. And I can see the Button is working fine, but panels are not coming up.

App.js:

import React from "react";
import { Button } from "react-bootstrap";
import { Container, Row, Col } from "react-bootstrap";

import "./App.css";

function App() {
  return (
    <div>
      <center>
        <Button href="#">Link</Button>
      </center>
      <div class="panel panel-default">
        <div class="panel-heading">Panel Heading</div>
        <div class="panel-body">Panel Content</div>
        <div class="panel-footer">Panel Footer</div>
      </div>
    </div>
  );
}

export default App;

Here is the output but it does not display the panels properly:

enter image description here

Ajeet Shah
  • 18,551
  • 8
  • 57
  • 87
rawrstar
  • 165
  • 1
  • 14

1 Answers1

1

Step.1: install bootstrap

npm install bootstrap

Step.2: include bootstarp CSS

import "bootstrap/dist/css/bootstrap.min.css";

Also, Note that in your code, you are using class instead of className. Though, it might work but with warnings. Check how to do styling in reactjs.

Example:

import React from 'react';
import 'bootstrap/dist/css/bootstrap.min.css';

export default function App() {
  return (
    <div className="card">
      <div className="card-header">Card Header</div>
      <div className="card-body">Card Body</div>
      <div className="card-footer text-muted">Card Footer</div>
    </div>
  );
}

Here is a sandbox

Ajeet Shah
  • 18,551
  • 8
  • 57
  • 87