Radio buttons positioning

Hi. I am trying to find a method to position radio buttons closer to each other vertically.
When I write :

radio = createRadio();
    radio.option('option-3');"width", "80px");
    radio.position(50, 50);

I get the vertical distance of the first group of this image. But I would like to achieve a very close distance like in the second group. I have tried a lot of different style options like:‘margin-top’, “-1px”)

, padding, etc., but nothing works. Is this possible?


  radio = createRadio();
  let options = selectAll("input[type='radio']", radio);
  // Update the style for each option
  for (let opt of options) {"position", "relative");
    // The more negative these are the more the options will overlap"margin-top", "-1px");"margin-bottom", "-1px");
    // by default, when you mess with vertical spacing, the buttons get a
    // misaligned from the labels, adjust this to taste."top", "2px");
  }"width", "80px");
  // radio inputs and labels are displayed inline, so line-height introduces
  // space between them when the wrap over multiple lines."line-height", "0");
  radio.position(50, 50);

You could also do something similar with a stylesheet.

1 Like

Thank you so much for this!