React Bootstrap Borders
React Borders - Bootstrap 4 & Material Design
Note: This documentation is for an older version of Bootstrap (v.4). A
newer version is available for Bootstrap 5. We recommend migrating to the latest version of our product - Material Design for
Bootstrap 5.
Go to docs v.5
React Bootstrap borders are lines placed on the edges of buttons, images, and other web elements. Additionally, border-radius class rounds the elements corners.
Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.
Border
Use border utilities to add or remove an element’s borders. Choose from all borders or one at a time.
Additive
import React from "react";
import './index.css';
const BorderPage = () => {
return (
<>
<span className="block-example border border-dark"></span>
<span className="block-example border-top border-dark"></span>
<span className="block-example border-right border-dark"></span>
<span className="block-example border-bottom border-dark"></span>
<span className="block-example border-left border-dark"></span>
</>
);
}
export default BorderPage;
.block-example {
width: 6rem;
height: 6rem;
margin: 0.5rem;
background-color: #eee;
display: inline-block;
}
Subtractive
Use border utilities to add or remove an element’s borders. Choose from all borders or one at a time.
import React from "react";
import './index.css';
const BorderPage = () => {
return (
<>
<span className="block-example border border-0 border-dark"></span>
<span className="block-example border border-top-0 border-dark"></span>
<span className="block-example border border-right-0 border-dark"></span>
<span className="block-example border border-bottom-0 border-dark"></span>
<span className="block-example border border-left-0 border-dark"></span>
</>
);
}
export default BorderPage;
.block-example {
width: 6rem;
height: 6rem;
margin: 0.5rem;
background-color: #eee;
display: inline-block;
}
Border color
Change the border color using utilities built on our theme colors.
import React from "react";
import './index.css';
const BorderPage = () => {
return (
<>
<span className="block-example border border-primary"></span>
<span className="block-example border border-secondary"></span>
<span className="block-example border border-success"></span>
<span className="block-example border border-danger"></span>
<span className="block-example border border-warning"></span>
<span className="block-example border border-info"></span>
<span className="block-example border border-light"></span>
<span className="block-example border border-dark"></span>
<span className="block-example border border-white"></span>
</>
);
}
export default BorderPage;
.block-example {
width: 6rem;
height: 6rem;
margin: 0.5rem;
background-color: #eee;
display: inline-block;
}
Border-radius
Add classes to an element to easily round its corners.
import React from "react";
import './index.css';
const BorderPage = () => {
return (
<>
<img className="rounded mb-0" alt="100x100" src="https://placehold.it/100x100" />
<img className="rounded-top" alt="100x100" src="https://placehold.it/100x100" />
<img className="rounded-right" alt="100x100" src="https://placehold.it/100x100" />
<img className="rounded-bottom" alt="100x100" src="https://placehold.it/100x100" />
<img className="rounded-left" alt="100x100" src="https://placehold.it/100x100" />
<img className="rounded-circle" alt="100x100" src="https://placehold.it/100x100" />
<img className="rounded-pill" alt="150x75" src="https://placehold.it/150x75" />
<img className="rounded-0" alt="100x100" src="https://placehold.it/100x100" />
</>
);
}
export default BorderPage;
img {
margin: 0.5rem;
}