question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ButtonGroup] Breaking when adding href to Button

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When using MUI’s ButtonGroup, as soon as we add an href to one of the buttons, it breaks the layout, like so:

<ButtonGroup variant="contained" aria-label="outlined primary button group">
  <Button href="test.com">One</Button>
  <Button>Two</Button>
  <Button>Three</Button>
</ButtonGroup>

Result:

broken ButtonGroup

Expected behavior 🤔

ButtonGroup example

Steps to reproduce 🕹

Steps:

  1. Using MUI’s ButtonGroup, like so:
<ButtonGroup variant="contained" aria-label="outlined primary button group">
  <Button>One</Button>
  <Button>Two</Button>
  <Button>Three</Button>
</ButtonGroup>
  1. Adding href to one of the buttons

Context 🔦

No response

Your environment 🌎

Using BraveBrowser Version 1.35.104 Chromium: 98.0.4758.109 (Build officiel) (x86_64)

`npx @mui/envinfo`
  System:
    OS: macOS 12.2.1
  Binaries:
    Node: 17.5.0 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 98.0.4758.109
    Edge: Not Found
    Firefox: Not Found
    Safari: 15.3
  npmPackages:
    @emotion/react: ^11.8.1 => 11.8.1 
    @emotion/styled: ^11.8.1 => 11.8.1 
    @mui/base:  5.0.0-alpha.69 
    @mui/icons-material: ^5.4.2 => 5.4.2 
    @mui/material: ^5.4.3 => 5.4.3 
    @mui/private-theming:  5.4.2 
    @mui/styled-engine:  5.4.2 
    @mui/styles: ^5.4.2 => 5.4.2 
    @mui/system:  5.4.3 
    @mui/types:  7.1.2 
    @mui/utils:  5.4.2 
    @types/react:  17.0.39 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MaksymSlobodianykcommented, Apr 20, 2022

Hi, are there any updates on this? This issue stops me from upgrading to v5. v4 doesn’t have such an issue.

0reactions
hbjORbjcommented, Dec 27, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Material UI ButtonGroup breaks when adding href to Button
Here is the CodeSandbox with reproduction ! When using MUI's ButtonGroup, the layout is fine with three "regular" buttons: <ButtonGroup variant= ...
Read more >
Button group - Bootstrap
Group a series of buttons together on a single line with the button group, and super-power them with JavaScript.
Read more >
Adding a Link to a Bootstrap Button with React Router
While working on my React based portfolio website recently, I ran into an issue regarding buttons and links. I had designed a section...
Read more >
Selection and Nesting in JavaScript ButtonGroup control
ButtonGroup supports radio type selection in which only one button can be selected. This can be achieved by adding input element along with...
Read more >
Create radio button component - MATLAB uiradiobutton
Subsequent buttons added to the same button group have a default state of 0 . When the Value property of a RadioButton changes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found