Page 1 of 1

Setting size of ionic-input

Posted: Sat Oct 24, 2020 12:15 am
by kevinmcisaac

I have several ion-inputs, type=number, in a grid row and I expect that on smaller devices this should wrap.

This works fine in the xs/sm setting in testing but in the APK on my phone one of the input element is too small (only takes 3 digits and I need 4) and clips the numbers withmore than 3 digits. I'd like to be able to set the minimum size of the input.

I've tried setting the "size" attribute but this had no impact. What is the right way to do this


Re: Setting size of ionic-input

Posted: Tue Nov 03, 2020 3:09 pm
by Serhii Kulibaba

Hello Kevin,

What project type do you use Ionic 1 or Ionic 4? Do you use Appery.io default input component or the custom one using the HTML layout?


Re: Setting size of ionic-input

Posted: Wed Nov 04, 2020 5:14 am
by kevinmcisaac

IONIC4, default input component


Re: Setting size of ionic-input

Posted: Tue Nov 10, 2020 1:29 pm
by Serhii Kulibaba

Please try the same with the HTML component and the standard Ionic input https://ionicframework.com/docs/api/input
Does the size work for you there?


Re: Setting size of ionic-input

Posted: Wed Nov 11, 2020 1:00 am
by kevinmcisaac

The IONIC documentation indicates using the size attribute, however this does not work due to the CSS width definitions overrising this.

I found that simply setting the width in CSS was fine, i.e., I defined the follow CSS

Code: Select all

.fourdigits {min-width: 44px;}

.threedigits { min-width: 34px; }

then added that as a class to the ion-input using the class properly in the panel.


Re: Setting size of ionic-input

Posted: Mon Nov 16, 2020 5:24 pm
by Serhii Kulibaba

Please use an attribute "maxlength" instead of "size", it should work fine with the input component