How to align the radio buttons horizontally in angular material?

Asqan picture Asqan · Jun 29, 2015 · Viewed 44.2k times · Source

I was expecting a in-built directive or a tag for this but probably not according to their documentation.

This is the example.

<div class="radioButtondemoBasicUsage" ng-app="MyApp">
<form ng-submit="submit()" ng-controller="AppCtrl">
<p>Selected Value: <span class="radioValue">{{ data.group1 }}</span> </p>

<md-radio-group ng-model="data.group1">

  <md-radio-button value="Apple" class="md-primary">Apple</md-radio-button>
  <md-radio-button value="Banana"> Banana </md-radio-button>
  <md-radio-button value="Mango">Mango</md-radio-button>

</md-radio-group>

Answer

F&#225;bio Palmeira picture Fábio Palmeira · Oct 2, 2015

You do not need to override any default CSS:

<md-radio-group layout="row">
  <md-radio-button value=0 class="md-primary">On</md-radio-button>
  <md-radio-button value=1> Off </md-radio-button>
</md-radio-group>

enter image description here

Just put in md-radio-group tag a layout="row" attribute.