Developers can use the alignment property to control how the label and control are aligned on the cross axis. This property mirrors the flexbox align-items property.
note
Stacked checkboxes can be aligned using the alignment property. This can be useful when the label and control need to be centered horizontally.
<!-- Basic --> <!-- Before --> <ion-item> <ion-label>Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkbox>Checkbox Label</ion-checkbox> </ion-item> <!-- Fixed Labels --> <!-- Before --> <ion-item> <ion-labelposition="fixed">Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkboxlabel-placement="fixed">Checkbox Label</ion-checkbox> </ion-item> <!-- Checkbox at the start of line, Label at the end of line --> <!-- Before --> <ion-item> <ion-labelslot="end">Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkboxlabel-placement="end">Checkbox Label</ion-checkbox> </ion-item>
<!-- Basic --> <!-- Before --> <ion-item> <ion-label>Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkbox>Checkbox Label</ion-checkbox> </ion-item> <!-- Fixed Labels --> <!-- Before --> <ion-item> <ion-labelposition="fixed">Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkboxlabelPlacement="fixed">Checkbox Label</ion-checkbox> </ion-item> <!-- Checkbox at the start of line, Label at the end of line --> <!-- Before --> <ion-item> <ion-labelslot="end">Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkboxlabelPlacement="end">Checkbox Label</ion-checkbox> </ion-item>
{/* Basic */} {/* Before */} <IonItem> <IonLabel>Checkbox Label</IonLabel> <IonCheckbox></IonCheckbox> </IonItem> {/* After */} <IonItem> <IonCheckbox>Checkbox Label</IonCheckbox> </IonItem> {/* Fixed Labels */} {/* Before */} <IonItem> <IonLabelposition="fixed">Checkbox Label</IonLabel> <IonCheckbox></IonCheckbox> </IonItem> {/* After */} <IonItem> <IonCheckboxlabelPlacement="fixed">Checkbox Label</IonCheckbox> </IonItem> {/* Checkbox at the start of line, Label at the end of line */} {/* Before */} <IonItem> <IonLabelslot="end">Checkbox Label</IonLabel> <IonCheckbox></IonCheckbox> </IonItem> {/* After */} <IonItem> <IonCheckboxlabelPlacement="end">Checkbox Label</IonCheckbox> </IonItem>
<!-- Basic --> <!-- Before --> <ion-item> <ion-label>Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkbox>Checkbox Label</ion-checkbox> </ion-item> <!-- Fixed Labels --> <!-- Before --> <ion-item> <ion-labelposition="fixed">Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkboxlabel-placement="fixed">Checkbox Label</ion-checkbox> </ion-item> <!-- Checkbox at the start of line, Label at the end of line --> <!-- Before --> <ion-item> <ion-labelslot="end">Checkbox Label</ion-label> <ion-checkbox></ion-checkbox> </ion-item> <!-- After --> <ion-item> <ion-checkboxlabel-placement="end">Checkbox Label</ion-checkbox> </ion-item>