Is there a reason why I can't seem to display the rc-slider and its label side-by-side on the same row?

When trying to add a label to the rc-slider in the same row using bootstrap grid, I noticed that the label and slider are appearing on two separate rows.

 <div className="row">
      <div className="col">
          Label:
      </div>
      <div className="col">
      <Slider value={this.props.sample} 
          onChange={this.onSliderChange} 
          onAfterChange={this.onAfterChange}
          defaultValue={13}
      />
  </div>

Answer №1

Make sure to enclose the row within a div that has the class container.

<div class="container">
  <div className="row">
    <div className="col">
      Label:
    </div>
    <div className="col">
      <Slider value={this.props.sample} onChange={this.onSliderChange} onAfterChange={this.onAfterChange} defaultValue={13} />
    </div>
  </div>
</div>

For more information on using grids, refer to the documentation at: https://getbootstrap.com/docs/4.1/layout/grid/

Answer №2

If you're experiencing difficulty with incorporating Bootstrap, make sure to verify if Bootstrap is loading in your devtools network tab. Once you've confirmed that, adjust the className of the columns class in Bootstrap as shown below. This adjustment should resolve the issue for you.

<div className="row">
  <div className="col-lg-1>
    Label
  </div>
  <div className="col-lg-11">
    <Slider
      value={10}
      onChange={this.onSliderChange}
      onAfterChange={this.onAfterChange}
    />
  </div>
</div>

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

Adjust the size of a division based on the width of the screen using JavaScript

Is there a way to create a JavaScript function that dynamically adjusts the size of a div, image, or padding based on the screen width without using CSS? I am specifically interested in adjusting the padding of a div element. Here is a sample code snippet ...

What steps can be taken to address React Webpack-Dev-server's concerns over bundle size?

Greetings and thank you for taking the time to read this message. I am currently in the process of developing a full-stack react/express application from scratch. While I have made progress, I am encountering an issue with webpack-dev-server complaining ab ...

What is the proper way to target a div element that has the class of "name1 name2"?

Currently, I am learning CSS through a tutorial and there is a div with the class: <div class="related products"> I am curious, how do I target this specific div in my stylesheet? ...

Deactivate the listbox in Material UI Autocomplete after a selection has been made

In my React.js project, I am building an Autocomplete component using the Material-UI headless useAutoComplete hook. The component functions correctly, but there is an issue that arises when users make selections and then focus back on the input field caus ...

What is the best way to deactivate a chosen date on the Material UI calendar after it has been saved as a booking in the system?

Recently, I added a convenient calendar feature using Material UI Date & Time picker to my React app form. This allows users to easily select a date and time (similar to a booking system) along with submitting their name and email. My plan was to save the ...

What method does the Next.js new Image component use to determine the size of the device when the layout prop is set to "responsive"?

While the current viewport size is detected correctly on desktop, there seems to be an issue when simulating mobile view using Chrome Dev Tools where the Image component detects the incorrect device size. I am curious about how the Image component determi ...

Saving the order of elements dropped in jQuery UI Droppable into an input field

Link to setup: https://jsfiddle.net/7b8bqzsh/1/ You can view a full working example using the link provided above. The objective is to store the order of the links in an input field so that it can be saved to a database. Currently, only the latest ID is ...

Utilize ng-repeat to iterate over two arrays

Two arrays are at my disposal here. The first array contains option content, while the second array consists of option tags (i.e., A, B, C, D). How can I structure the layout for the 'input type="radio"' using ng-repeat? To start off, I am attem ...

Use Enums instead of conditions in Typescript

Consider the code snippet below, which is a function that generates a CSS class based on the value of toCheck: const computeSomething = (toCheck: string) => { return clsx('flex', { 'flex-start': toCheck === 'FIRST', ...

What is causing these images to appear larger than their original sizes?

My issue involves extracting multiple images from Facebook and displaying them in a scroller. When clicked, a dialog box appears with the full-size image (the images initially displayed are thumbnails obtained from a Facebook query using `src_small`). The ...

The React server experienced a front-end crash due to a node internal buffer error at location 959

Currently working on developing an ecommerce platform using a combination of Strapi for the backend and React for the frontend. Encountering a perplexing error at the moment: node:internal/buffer:959 super(bufferOrLength, byteOffset, length); ^ RangeErr ...

Can the color of an ion-radio be adjusted when it is not selected?

I am experiencing an issue where I need to change the default color (grey) to a specific color of my choice, such as the primary color. I have attempted the following methods: <ion-col sizeXs="12" sizeMd="6" class="radio-box"> <ion-item line ...

The "Temporary Text" feature in an HTML form

Seeking assistance with implementing dynamic text in place of static text for the placeholder attribute, sourced from a key-value pair in a localization file. Currently developing on the Aurelia framework and would appreciate any guidance on this matter. T ...

Boost the delay in the transition speed for hiding the Navbar while scrolling down with the help of Bootstrap

Hi there! I am currently learning HTML, CSS, and JS. I'm working on a homepage project using Bootstrap-5 and have successfully integrated a navbar. However, I've noticed that the navbar disappears too quickly when I scroll down. Is there a way to ...

Switch image on click (toggle between pause and play buttons)

Having some difficulty setting up a 3D audio player in A-Frame where the pause and play button images need to change depending on whether the audio is playing or not. Interested in seeing my code in action? Check it out here. ...

Ensure each individual flex item stretches to their specific needs

Is there a way to make child-6 stretch to half the height of its parent without splitting the 6 items into 2 groups? I've tried stretching child-6 but it doesn't seem to work as expected. It makes sense that stretching a specific item will consum ...

Repositioning a jQuery function from inside a plugin

I need assistance with customizing the functionality of a jQuery plugin called AjaxFileUpload. You can find the plugin here: https://github.com/davgothic/AjaxFileUpload The current behavior of the plugin is that it uploads the file as soon as it is select ...

Obtain geographic information using a JSON fetch from a map

I am facing an issue while integrating Laravel API data into React. Although I can see the JSON data in the console after fetching it, I encounter an error when I try to display it in a table for listing. The error states that my .map function is not recog ...

Chrome is able to interpret Behat CSS selectors, whereas Firefox struggles with them

Recently I began working with Behat and Selenium for website test automation. One issue I've encountered is that some CSS selectors work in Chrome but not in Firefox. For instance, in my Behat code: Then I press ".topmember-resultList .resultListIte ...

What could be causing the malfunction of Bootstrap Multiselect functionality?

I have been attempting to set up Bootstrap Multiselect but it simply refuses to work. Despite trying various solutions, I am unable to pinpoint the issue. My index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...