Leveraging react-select for crafting the layout with the help of bootstrap 4 framework

As a beginner in the realm of react-redux, I am attempting to achieve a specific markup design.

https://i.sstatic.net/YWGS0.png

After implementing the code below, you can see that I was able to accomplish the following structure:

<div className="row">
        <div className="col-md-12">
          <form className="form-inline">
            <div className="form-group col-md-4">
              <lable>Select Technolgoy </lable>
              <Select
                value={selectedOption}
                onChange={this.handleChange}
                options={options}
              />
            </div>
            <div className="form-group col-md-4">
              <lable>Select Component </lable>
              <Select
                value={selectedOption}
                onChange={this.handleChange}
                options={options}
              />
            </div>
            <div className="form-group col-md-4">
              <lable>Select Job </lable>
              <button className="btn btn-primary">
                Add
              </button>
              <button className="btn btn-primary">
                Remove
              </button>
            </div>
          </form>
        </div>
      </div>

https://i.sstatic.net/lgNEl.png

In this setup, I have utilized the react-select component.

If there are any mistakes in my approach, could someone kindly provide guidance? Thank you.

Answer №1

To enhance the appearance of your selects, make sure to update the styles with the following adjustments:

const customStyles = {
  dropdownIndicator: base => ({
    ...base,
    color: 'blue'
  })
};

function App() {
  return (
    <div className="row">
      <div className="col-12">
        <form className="form-inline">
          <div className="form-group col-4">
            <lable>Select Color</lable>
            <Select styles={customStyles} options={colorOptions} />
          </div>
          <div className="form-group col-4">
            <lable>Select Size</lable>
            <Select styles={customStyles} options={sizeOptions} />
          </div>
          <div className="form-group col-4 row">
            <lable className="col-4">Select Quantity</lable>
            <button className="btn btn-primary col-4">Add</button>
            <button className="btn btn-danger col-4">Remove</button>
          </div>
        </form>
      </div>
    </div>
  );
}

An interactive demo is available here.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

While HTML and CSS collaborate seamlessly during development, CSS mysteriously disappears when transitioning to production mode

I am brand new to this field and I apologize in advance for any mistakes. Currently, I am working on a node.js project using webpack and HTML loader. To test the project, I am utilizing the dev server dependency to run it locally. All models, views, and te ...

The ReactJS script encountered an error at line 2 of the jquery.min.js file, displaying an unrecognized expression syntax error with the hashtag

I have encountered an issue with React-route-dom Link while using it in the Navbar. The following error is displayed: Uncaught Error: Syntax error, unrecognized expression: #/login at Function.ga.error (jquery.min.js:2) at ga.tokenize (jquery.min. ...

What is the best way to retrieve the results from the event handler triggered by window.external.Notify("someText") in order to send them back to JavaScript?

Using window.external.Notify("someText") in my Windows Phone 8 HTML5 Application function func() { window.external.Notify("clearTextBox"); } An event handler for ScriptNotify has been implemented private void BrowserScriptNotify(object sender, Not ...

Having difficulties including the Stack Overflow website within an iframe

I've been attempting to embed the Stack OverFlow website into an HTML page using an iFrame, but I'm running into some issues. Oddly, when I tried embedding my other two websites, they displayed correctly, but Stack OverFlow is not showing up on m ...

Learning about managing the previous state in React

I'm trying to figure out the previous state in order to decide whether to update a value. I've created a small code example but I'm having trouble understanding it. import React, { useEffect, useRef, useState } from "react"; expo ...

Retrieve dashboard configurations in AngularJS by making an $http request prior to initiating the dashboard controller

I am currently immersing myself in Angular and tackling a complex dashboard framework all built with Angular. Prior to loading the controllers, I need to fetch various dashboard settings from the server using $HTTP. These settings play a crucial role in de ...

Design a footer using HTML specifically for the bottom section of the document, rather than the

I'm facing an issue on a website where the footer is not sticking to the bottom of the document body in HTML. The problem arises when I try to place the footer at the end of the content, leading to white space after it. If I use fixed positioning for ...

The assignment of ajax success data to variables results in an error because data[0] is not defined

Having some trouble retrieving and assigning data from a database in JavaScript using AJAX to call a PHP script with a MySQL query. Although the AJAX request is successful, when trying to store the data into variables, they appear as undefined or NaN in th ...

Is there a variance in DPI [font sizes] between QWebView and other QWidgets?

I have a QWebView that is showing HTML content styled with CSS: body { font-size: 10pt; } Within the same window, there is also a QTextEdit field where I adjusted the font like this: QFont newFont; newfont.setPointSize(10); myEditField->setFont(newFo ...

Could it be true that adding a string with ${class} to Tailwind does not function properly?

Some time ago, I inquired about a way to avoid repeating the same prefix in TailwindCSS like `hover:` multiple times here. Someone was able to solve the issue using javascript, which seems to be working perfectly fine for now. However, a commenter mentio ...

How to eliminate the header of the VuetifyJS v-tabs component?

Is there a way to use the functionality provided by the VuetifyJS v-tabs component without displaying the navigation header? If so, how can I achieve this? You can check out an example on CodePen <v-tabs v-model="active" color="cyan" dark slid ...

Challenges encountered while making CSS adjustments on the Wordpress Twentyfourteen theme

I'm currently assisting a friend with making some final adjustments to their website. The site is built on Wordpress using the Twentyfourteen theme and can be found at centromariposa.no. Most of the modifications have been completed, but I'm fac ...

To set up MongoDB on your system, execute the following command: `npm install --

I've encountered a problem while attempting to install MongoDB on my personal computer for a Node project. I used the command line and ran npm install --save mongodb. Even though MongoDB appears in the dependencies section of my package.json file with ...

Sending Data to Server from iOS Device (AJAX, HTTPS)

I've encountered an issue where I am unable to make an AJAX POST Request from my iOS (Cordova) App. The API URL has a secure certificate on www.myDomain.ch but not without the www prefix. Interestingly, when I tested the Request with a tool or in a Re ...

When utilizing array.push() with ng-repeat, it appears that separate scopes are not generated for each item

I'm currently working on an Angular View that includes the following code snippet: <div ng-repeat="item in items track by $index"> <input ng-model="item.name"/> </div> Within the controller, I utilize a service to retrieve a Js ...

What is the best way to conceal elements that do not have any subsequent elements with a specific class?

Here is the HTML code I have, and I am looking to use jQuery to hide all lsHeader elements that do not have any subsequent elements with the class 'contact'. <div id="B" class="lsHeader">B</div> <div id="contact_1" class="contac ...

Troubleshooting the issue with mocking API and creating a regular expression to match the dynamic part of a URL

I am struggling to create a mock for an API that includes dynamic parts in the URL. I attempted to use a regular expression, but it is not functioning as expected. The URL I am trying to mock is: https://example.com/programs/2fcce6e3-07ec-49a9-9146-fb84fb ...

Bootstrap arranges checkboxes into three evenly spaced columns and centers them within a form

Having trouble organizing my checkboxes into 3 columns and centering them within the form perfectly. Current layout: Click here for image Desired look: Click here for image HTML: ` <form action="/signup" method="POST" ...

Can you recommend any effective JavaScript and AJAX interface designs for websites?

I admire how websites like FogBugz and Facebook provide dynamic user interfaces by loading content asynchronously. Are there specific methods and techniques for implementing this on other sites? I'm interested in a solution that generates a unique ha ...

Include user input to an array in Javascript

I have a code snippet that allows users to enter words into an input box and store them in an array by clicking the Add Word button. Once multiple words have been entered, users can click the Process Word button to display all the words from the array. I ...