Aligning radio button vertically in React using Bootstrap styling

I am struggling to align a radio button within a container inline with other buttons on the right. Can anyone provide guidance on how to resolve this issue?

Here is my current setup:

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

Code:

import React, { Component } from "react";
import { Box, Flex } from "@rebass/grid";
import cx from "classnames";
import styled from "styled-components/macro";
import {
  Button,
  ButtonGroup,
  Classes,
  Colors,
  Divider,
  Icon,
  Radio,
  RadioGroup
} from "@blueprintjs/core";
import { IconNames } from "@blueprintjs/icons";
import "normalize.css/normalize.css";
import "@blueprintjs/core/lib/css/blueprint.css";
import "@blueprintjs/icons/lib/css/blueprint-icons.css";
import "@blueprintjs/select/lib/css/blueprint-select.css";
import "bootstrap/dist/css/bootstrap.css";

const ScenarioIcon = styled(Button)`
  transition: all 0.2s ease;
}
`;

class App extends Component {
  constructor() {
    super();
    this.state = {
      name: "React"
    };
  }

  render() {
    return (
      <Flex>
        <Box width={"100%"}>
          <div
            style={{
              padding: "20px",
              backgroundColor: "red"
            }}
            className={cx("bp3-card bp3-interactive")}
          >
            <Flex alignItems="center" style={{ backgroundColor: "green" }}>
              <RadioGroup onChange={() => {}} selectedValue={1}>
                <Radio
                  style={{ backgroundColor: "yellow" }}
                  className={cx(Classes.TEXT_LARGE)}
                  label={"Sample"}
                  value={1}
                />
              </RadioGroup>
              <Box flex="auto" />
              <ButtonGroup>
                <ScenarioIcon
                  className="utility-button"
                  icon={<Icon icon={IconNames.EDIT} color={Colors.WHITE} />}
                  minimal={true}
                  title="Edit"
                />
                <ScenarioIcon
                  className="utility-button"
                  icon={
                    <Icon icon={IconNames.DUPLICATE} color={Colors.WHITE} />
                  }
                  minimal={true}
                  title="Copy"
                />
                <ScenarioIcon
                  className="utility-button"
                  icon={
                    <Icon
                      icon={IconNames.DOCUMENT_SHARE}
                      color={Colors.WHITE}
                    />
                  }
                  minimal={true}
                  title={"Archive"}
                />
                <ScenarioIcon
                  className="utility-button"
                  icon={
                    <Icon
                      icon={IconNames.TRASH}
                      color={Colors.RED1}
                      color={Colors.WHITE}
                    />
                  }
                  minimal={true}
                  title="Delete"
                />
                <Divider />
              </ButtonGroup>
              <Icon
                icon={IconNames.CHEVRON_RIGHT}
                color={Colors.WHITE}
                className="align-self-center"
                iconSize={20}
              />
            </Flex>
          </div>
        </Box>
      </Flex>
    );
  }
}

export default App;

CodeSandbox Link: Link

P.S: I am open to using bootstrap as well for alignment.

Answer №1

Upon my observation, it appears that there is a noticeable bottom margin applied to the Radio element. By implementing the following style on the 'Radio', it functions as intended.

style={{ backgroundColor: "yellow", marginBottom: "0" }}

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

What is the best way to reveal CSS files downloaded via npm?

I'm currently working on a Sass/CSS library that I have hosted on npm. I am exploring ways to make it easier for clients to access it, such as using: @import 'library_name' Instead of the less appealing option: @import 'node-modules/ ...

The color of active links in TailwindCSS remains unchanged

In my project, I am using NextJS along with Tailwind CSS to create a top navigation bar. My goal is to change the text color for active links within the navigation bar. Below is the code snippet I have implemented: const Header = () => { return( ...

When trying to make edits, the cursor automatically jumps to the end of the field

In Safari, there is a strange issue occurring with a text field used for emails. When entering text and trying to edit by moving the cursor, new characters are automatically placed at the end of the text. It seems that the problematic code causing this beh ...

Creating a dropdown menu and adjusting the content below

Feeling stuck in one place with my code here: link The side navbar animation is almost what I want, but clicking one option opens all of them. Hoping for a similar effect like this page: link $(document).ready(function() { $('.interfejs, .proces ...

Looking to access the layout details of an HTML element similar to what can be done in Firefox's debugger tool?

I am facing a challenge with a aspx.net grid control where I need to extract the first row's information and copy it into another table using JavaScript. To achieve this, I am attempting to calculate the width of each cell in the first row by accessin ...

The blur() function does not function properly on IOS devices such as iPad and iPhone

I've attempted using blur() to change the CSS, but it seems that this function is not effective. After researching, I discovered that blur() does not work on IOS devices. Is there an alternative method for removing the position from .body-clip-overflo ...

Making rapid formatting changes by rearranging the positioning of words in Javascript

Struggling to untangle my complex code, I'm unable to make the necessary adjustments. Here's what I have: var stocks= [ ["Beef (80/20) raw","oz",115.4451262,3.293742347,72,"4.85 gallons","5.65 pounds","0 - ",2.142,19,20,"0.0001275510204"," ...

Is there a way to set up Selenium so that Chrome already has an extension installed?

We are currently running a series of tests that utilize Selenium to generate Chrome instances when executed on a local system. These Chrome instances are created with basic, default profiles that have no extensions enabled. However, we are interested in po ...

I could use some assistance getting my initial open source project up and running

Attempting to set up my first open-source project on my 2018 MacBook Pro 15” with Big Sur 11.1 (20C69) has been a bit of a challenge. Using VS Code as my IDE, I successfully forked and cloned the repository for my project. The instructions for running t ...

Is it possible to personalize the Facebook like box appearance?

Is there a way to modify the number of feeds and enable auto scroll feature in a Facebook likebox? I've been experimenting with the code snippet below but have hit a roadblock. <div id="fb-root"></div><script>(function(d, s, id) {va ...

What is the method for utilizing the onmouseover function to emphasize a specific part of an SVG graphic?

I am attempting to create an interactive SVG map of Europe. Each country is represented by a path element, and I want the opacity of a country to change to 0.5 when it is hovered over. Despite trying to define a JavaScript function for this purpose, noth ...

What could be the reason that my Bootstrap design is displaying narrower than the designated container?

Having some issues with a JavaScript code that involves innerHTML, causing a discrepancy in width compared to the CSS and Bootstrap rules I have set up. Below is the JavaScript code snippet: let numeroStreams = document.getElementById('num') let ...

Is it possible to make a form field inactive based on another input?

I need help with disabling certain form fields until other fields are filled in. You can check out an example of what I'm trying to achieve here: https://jsfiddle.net/fk8wLvbp/ <!-- Bootstrap docs: https://getbootstrap.com/docs --> <div ...

Line divider immediately following the title on the same row

I am looking to insert a separator line immediately following the H1 tag, however my attempts have been unsuccessful. Can someone provide assistance with this? <style> #sepr { border-top-width: 3 px; border-top-style: solid; ...

issues arising from the kendo theme design within the angular framework

In my Angular project, I am utilizing the Kendo user interface, but I am struggling to figure out how to adjust the size and apply different themes to all the elements. For instance, I would like to have a small button with a danger color. While it is pos ...

Fixing compatibility problems, security risks, alerts, clashes, and disparate releases within React

I am currently working on: Resolving the dependency issues that are surfacing in my React application Gaining a deeper understanding of why these issues are occurring Finding the best approach to address these types of problems properly, without resorting ...

Divs should be of consistent and adjustable height

I am in need of a layout with three columns: left column (with a red background) center column (with a yellow background) right column (with a black background) This is the HTML structure I have in mind: <div id="container"> <div id="left_ ...

There seems to be an issue with Bootstrap not condensing into two columns properly on mobile devices

I need help figuring out how to turn a row of 4 images into two columns on tablet and mobile devices. Currently, they are stacking in a single column instead of forming two columns. Basically, I want the images to adjust and display in two columns when vi ...

How to set a default value different from the available options using jQuery

<select id="itemDepartment"> <option value="1">Computer Accessories</option> <option value="2">Laptop</option> </select> the default value in the drop-down list can be set using the selected="selected" attribute. ...

Ways to retrieve the current URL in Next.js without relying on window.location.href or React Router

Is there a way to fetch the current URL in Next.js without relying on window.location.href or React Router? const parse = require("url-parse"); parse("hostname", {}); console.log(parse.href); ...