I have a label and group radio button (two) and i want to make it to be horizontally aligned like in the picture.
I tried this code:
`<ion-row radio-group [(ngModel)]="Sexe">
<ion-col>
<ion-item>
<ion-label color="primary">Sexe</ion-label>
<ion-radio value="Mr"></ion-radio>
<ion-radio value="Mme"></ion-radio>
</ion-item>
</ion-col>
</ion-row>`
and also this code:
`<ion-row radio-group [(ngModel)]="Sexe">
<ion-col>
<ion-item>
<ion-label color="primary">Sexe</ion-label>
</ion-item>
<ion-item>
<ion-radio value="Mr"></ion-radio>
</ion-item>
<ion-item>
<ion-radio value="Mme"></ion-radio>
</ion-item>
</ion-col>
</ion-row>`
But i don't have the result that I want.
To make a horizontal radio button set, add the data-type="horizontal" to the fieldset . The framework will float the labels so they sit side-by-side on a line, hide the radio button icons and only round the left and right edges of the group.
Vertical positioning of radio buttons is safer. Radio buttons are tiny in nature, and, thus, according to Fitts' law, they can be hard to click or tap.
As a quick solution either you can apply colspan for your td or You can have both the radio button controls in same td so that the change due to long text wont affect the display of radiobutton.
To label a radio button, add a <label> element after the <input> element and insert a for attribute with the same value as the id of the associated <input> element. Then, write your label text in the <label> tag.
You can use ion-row
and ion-col
elements for that. Please take a look at this working plunker.
<ion-row radio-group [(ngModel)]="sexe">
<ion-col>
<ion-item>
Sexe
</ion-item>
</ion-col>
<ion-col>
<ion-item>
<ion-label>Homme</ion-label>
<ion-radio value="homme"></ion-radio>
</ion-item>
</ion-col>
<ion-col>
<ion-item>
<ion-label>Femme</ion-label>
<ion-radio value="femme"></ion-radio>
</ion-item>
</ion-col>
</ion-row>
Since we use a single row and three columns, the title and the radio items will be placed all in the same row (horizontally aligned).
<ion-row>
<ion-label class="ion-label" color=dark>Save</ion-label>
</ion-row>
<ion-row radio-group [(ngModel)]="relationship" class="item">
<ion-col>
<ion-radio value="manually" checked></ion-radio>
<ion-label>Manually</ion-label>
</ion-col>
<ion-col>
<ion-radio value="automatic"></ion-radio>
<ion-label>Automatically</ion-label>
</ion-col>
</ion-row>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With