SmoothScroll
React Bootstrap 5 SmoothScroll
Bootstrap React smooth scroll is an animated movement from one point on the page to another.
Importing the React Bootstrap 5 SmoothScroll Component
Import CDBSmoothScroll into your project to use the Contrast React Bootstrap 5 SmoothScroll component.
import { CDBSmoothScroll } from 'cdbreact';
Default SmoothScroll

import React from 'react';import { CDBSmoothScroll, CDBContainer } from 'cdbreact';
export const SmoothScroll = () => { const text = `Duis gravida porta mi ut ornare. Maecenas vel leo arcu. Praesent tincidunt est augue, id cursus dolor malesuada sit amet. Nullam vel leo quis purus tempus convallis vitae volutpat sem. Vestibulum blandit sodales aliquam. Aenean mauris erat, iaculis vel suscipit id, fringilla eu mauris. Vivamus sapien nulla, condimentum nec venenatis sit amet, lobortis eu magna. Nulla orci augue, cursus vitae velit nec, consectetur vehicula magna. Phasellus ornare et justo et maximus. In in tortor vitae diam vulputate dictum. Sed egestas scelerisque lacus vel interdum. Curabitur ex elit, semper ut diam ut, imperdiet dapibus arcu. Phasellus eget elit et est gravida ornare.`;
return ( <div className="text-white"> <CDBSmoothScroll to="section1" className="p-3 bg-warning mr-3"> Section 1 </CDBSmoothScroll> <CDBSmoothScroll to="section2" className="p-3 bg-primary mr-3"> Section 2 </CDBSmoothScroll> <CDBSmoothScroll to="section3" className="p-3 bg-success"> Section 3 </CDBSmoothScroll>
<CDBContainer className="bg-warning p-4 mt-3" id="section1"> {text} </CDBContainer> <CDBContainer className="bg-primary p-4" id="section2"> {text} </CDBContainer> <CDBContainer className="bg-success p-4" id="section3"> {text} </CDBContainer> </div> );};
Disabled state
To disable the SmoothScroll component, simply add the disabled
boolean property to CDBSmoothScroll
.
import React from 'react';import { CDBSmoothScroll, CDBContainer } from 'cdbreact';
export const SmoothScroll = () => { return ( <CDBContainer> <CDBSmoothScroll disabled /> </CDBContainer> );};
API Reference: Contrast React Bootstrap 5 SmoothScroll Props
This section will go over the props that come with the Contrast React Bootstrap 5 SmoothScroll component. You'll discover the importance of these props, how to use them in your code, and what their default values are.
The table below lists extra prop options for the CDBSmoothScroll
.
Name | Type | Default | Description | Example |
---|---|---|---|---|
className | String | Adds custom classes | Adds custom classes | <CDBSmoothScroll className="myClass" ... /> |
tag | String | div | Changes default input tag | <CDBSmoothScroll tag="input" ... /> |
disable | Boolean | false | Disables SmoothScroll component | <CDBSmoothScroll disabled .../> |
Trying to build out all user interfaces and components for your website or web app from scratch can become a very tedious task. A huge reason why we created Contrast Bootstrap to help reduce the amount of time we spend doing that, so we can focus on building some other aspects of the project. Contrast Bootstrap PRO consists of a UI Kit featuring over 10000+ component variants. Together with a template of 5 admin dashboards and 23+ additional multipurpose pages template for building almost any type of website or web app. You can view a demo and learn more about Contrast by clicking here.Download the free react template

Contrast Bootstrap PRO was built using the most popular CSS framework Bootstrap to help build your next landing, admin SAAS, prelaunch etc project with a clean, prebuilt and well documented template and UI components.Learn more about Contrast