How can I make a choice menu for text size?


#1

Here like this?Android-font-settings


#2

See: https://ionicframework.com/docs/components/#alert-checkbox


#3

Ok, thank you… than how to set variable to increase a font size in page?


#4

Hey @Harivamsi, you can bind variable to the select option and then you can use that variable to set font size of specific html tag like this:

<p [style.fontSize]="valueFromSelect">Some text</>

Here you will be assigning some value to valueFromSelect variable on choosing option from select and this variable should be defined in your .ts file. Hope you got my point. If not, please let me know, i’ll guide you in detail.
Cheers!!!


#5

Thaks before, Ok i’m not really understand, in my .ts file what should i set that value?


#6

Hi @Harivamsi, you must have set some value for your select which you used for selecting font size. For example: small would be 10px, Normal 12px and so on. You must have been tracking its value in some variable you defined in your .ts file. And you should use the same variable for [style.fontSize] = “valueFromSelect”. I mean it valueFromSelect should have value from your you used to select size.
Just a sample code:

<ion-select [(ngModel)]="valueFromSelect">
  <ion-option value="10px">Small</ion-option>
  //other options defined here
</ion-select>
//then use this where you want to use the selected font size
<p [style.fontSize]="valueFromSelect">Some text</>