Bootstrap 5 Search Results Example

Ruth Jul 09, 2026

Bootstrap, the popular CSS framework, has evolved significantly over the years, and with the release of Bootstrap 5, it has introduced several new features and improvements. One of the notable changes is the revamped search functionality, which now uses Bootstrap's new input group feature. Let's dive into an example of how to create search results using Bootstrap 5.

34 Best Bootstrap Search Box Examples 2026 - uiCookies
34 Best Bootstrap Search Box Examples 2026 - uiCookies

Before we start, ensure you have included the Bootstrap 5 CDN in your project's HTML file. If you haven't, add the following line within the section:

Bootstrap 5.3 (2025) Cheat Sheet
Bootstrap 5.3 (2025) Cheat Sheet

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">

Now, let's create a simple search form and display the results using Bootstrap 5.

Creating the Search Form

10 Bootstrap Dashboard Examples (+Templates) 2025 - AdminLTE.IO
10 Bootstrap Dashboard Examples (+Templates) 2025 - AdminLTE.IO

The first step is to create a basic search form using Bootstrap's input group feature. This allows us to combine form inputs and add-ons like buttons and icons in a single, flexible container.

Here's a simple example of a search form:

Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.
Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.

<div class="input-group mb-3">
  <input type="text" class="form-control" placeholder="Search...">
  <button class="btn btn-outline-secondary" type="button" id="search-btn">Search</button>
</div>

Styling the Search Form

By default, the search form will have some basic styling. However, you can customize it further to match your website's design. For instance, you can change the button's color or add some padding to the input field:

<style>
  .input-group .form-control {
    padding: 1.5rem;
  }
  #search-btn {
    background-color: #007bff;
    color: white;
  }
</style>

Displaying Search Results

Ynex - Blazor Server Bootstrap Admin Template
Ynex - Blazor Server Bootstrap Admin Template

Once the user submits the search query, we need to display the results. For this example, let's assume we have an array of items to search through. We'll use jQuery to handle the search functionality and display the results in a list.

First, include the jQuery library in your project's HTML file:

<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>

Implementing the Search Functionality

Bootstrap 5 Classes List Cheat Sheet
Bootstrap 5 Classes List Cheat Sheet

Now, let's add the jQuery script to handle the search functionality. In this example, we'll use a simple array of items and filter them based on the user's input:

<script>
  $(document).ready(function () {
    const items = [
      'Item 1',
      'Item 2',
      'Item 3',
      'Item 4',
      'Item 5',
      // Add more items as needed
    ];

    $('#search-btn').click(function () {
      const query = $('#search-input').val().toLowerCase();
      const filteredItems = items.filter(item => item.toLowerCase().includes(query));

      // Display the results
      $('#search-results').empty();
      filteredItems.forEach(item => {
        $('#search-results').append(`<li>${item}</li>`);
      });
    });
  });
</script>

Displaying the Search Results

Skodash - Bootstrap 5 Admin Template
Skodash - Bootstrap 5 Admin Template
9
9
Google Hasn't Kept Promise to Stop Bubble-Wrapping Users: Report
Google Hasn't Kept Promise to Stop Bubble-Wrapping Users: Report
a screenshot of a web page with multiple lines and numbers on the bottom right corner
a screenshot of a web page with multiple lines and numbers on the bottom right corner
100+ Best Free Bootstrap Templates 2024
100+ Best Free Bootstrap Templates 2024
Datta Able Bootstrap 5 Admin Template
Datta Able Bootstrap 5 Admin Template
FFG Forum Archive
FFG Forum Archive
the dashboard is displayed with several different items on it, including numbers and data for each item
the dashboard is displayed with several different items on it, including numbers and data for each item
a white page with the title google master's guide to google search console highlights
a white page with the title google master's guide to google search console highlights
40 Best Free Admin Dashboard Templates 2026 - Colorlib
40 Best Free Admin Dashboard Templates 2026 - Colorlib
the book bootstrap quick start 4 is shown in front of a white background
the book bootstrap quick start 4 is shown in front of a white background
two screens showing the dashboards for running and exercising in different stages of day to night
two screens showing the dashboards for running and exercising in different stages of day to night
the bootstrap 3 0 rc flat style ui kit
the bootstrap 3 0 rc flat style ui kit
an image of the search page for what is the best web search site? on dark background
an image of the search page for what is the best web search site? on dark background
Bootstrap 5 vs Bootstrap 4 - What's New & What Changed? - Super Dev Resources
Bootstrap 5 vs Bootstrap 4 - What's New & What Changed? - Super Dev Resources
an image of a cell phone screen with the text recovery code on it's side
an image of a cell phone screen with the text recovery code on it's side
the app for sports betting is open, but it's not very easy to use
the app for sports betting is open, but it's not very easy to use
the yellow and black flyer design for circles
the yellow and black flyer design for circles
the landing page for an airline website is shown in three different colors and font options
the landing page for an airline website is shown in three different colors and font options
an image of a website page with the wordpress pluger on top of it
an image of a website page with the wordpress pluger on top of it

Finally, add a list element to display the search results:

<ul id="search-results" class="list-group"></ul>

With this setup, when the user clicks the search button, the script will filter the items based on the input and display the results in the list.

In conclusion, creating search results with Bootstrap 5 is a breeze, thanks to its new input group feature and the flexibility of jQuery. This example demonstrates a simple search form and results display, but you can further customize and expand this functionality to suit your project's needs. Happy coding!