MDBootstrap is a Material Design and bootstrap-based Javascript UI library that is used to make attractive web pages with its seamless and easy-to-use component. It is free for both personal & commercial use. In this article, we will know how to use List Group Component in MDBootstap Javascript.
MDBootstrap List Group Component is a responsive component, used to make a group of lists for rendering the series of content.
Syntax:
<ul class="list-group"> <li class="list-group-item"> Content </li> ... </ul>
Approach:
- Download Javascript MDBootstrap from the official site.
- Extract the files to the current working directory.
- In the Index.html file, specify the downloaded file path in the <head> tag.
<link rel=”icon” href=”img/mdb-favicon.ico” type=”image/x-icon” />
<link rel=”stylesheet” href=”https://use.fontawesome.com/releases/v5.15.2/css/all.css” />
<link rel=”stylesheet” href=”https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap”/>
<link rel=”stylesheet” href=”css/mdb.min.css” />
<script type=”text/javascript” src=”js/mdb.min.js”></script>
<script type=”text/javascript”></script>
Example 1: This is the basic example that shows how to use List Group Component.
HTML
<!DOCTYPE html > < html lang = "en" > < head > < title >Javascript MDBootstrap List Group Component</ title > < meta charset = "UTF-8" /> < meta name = "viewport" content=" width = device -width, initial-scale = 1 , shrink-to-fit = no " /> < link rel = "icon" href = "img/mdb-favicon.ico" type = "image/x-icon" /> < link rel = "stylesheet" href = < link rel = "stylesheet" href = < link rel = "stylesheet" href = "css/mdb.min.css" /> < script type = "text/javascript" src = "js/mdb.min.js" > </ script > </ head > < body > < div style = "margin-left: 50px;" > < h2 style = "margin-top: 50px;" > neveropen </ h2 > < h4 > MDBootstrap Javascript List group Component </ h4 > < br > < ul style = 'width: 400px;' class = "list-group" > < li class = "list-group-item" > neveropen </ li > < li class = "list-group-item" > MDBootstrap </ li > < li class = "list-group-item" > Javascript </ li > < li class = "list-group-item" > Listgroup Component </ li > </ ul > </ div > </ body > </ html > |
Output:
Example 2: In this example, we will know how to make a checkbox in a List group component.
HTML
<!DOCTYPE html > < html lang = "en" > < head > < title >Javascript MDBootstrap List Group Component</ title > < meta charset = "UTF-8" /> < meta name = "viewport" content=" width = device -width, initial-scale = 1 , shrink-to-fit = no " /> < link rel = "icon" href = "img/mdb-favicon.ico" type = "image/x-icon" /> < link rel = "stylesheet" href = < link rel = "stylesheet" href = < link rel = "stylesheet" href = "css/mdb.min.css" /> < script type = "text/javascript" src = "js/mdb.min.js" > </ script > </ head > < body > < div style = "margin-left: 50px;" > < h2 style = "margin-top: 50px;" > neveropen </ h2 > < h4 > MDBootstrap Javascript List group Component </ h4 > < br > < ul style = 'width: 400px;' class = "list-group" > < li class = "list-group-item" > < input class = "form-check-input me-1" type = "checkbox" /> neveropen </ li > < li class = "list-group-item" > < input class = "form-check-input me-1" type = "checkbox" /> MDBootstrap </ li > < li class = "list-group-item" > < input class = "form-check-input me-1" type = "checkbox" /> Javascript </ li > < li class = "list-group-item" > < input class = "form-check-input me-1" type = "checkbox" /> Listgroup Component </ li > </ ul > </ div > </ body > </ html > |
Output:
Reference: https://mdbootstrap.com/docs/standard/components/list-group