I see that there is a responsive grid system for Ionic 2, but that appears to just let you create a grid style layout.
I'm looking for something that will allow me to display the view one way on a tablet, and another on a phone. In this specific instance, I have a list of jobs. If it's a tablet, I want to also show a map to the right of the list and plot them out. How to make the map I understand, but how do I tell what they are using and show the correct UI?
Desktop Browsers Because Ionic is based on web technologies, it works just as well on desktop browsers as it does on mobile devices. For more information on desktop layouts, see Cross Platform.
If you want to make your views responsive when using the grid, you can define how much space it used on different screen sizes. Simply add a bit more of text inside and see how it changes when making the window bigger or smaller.
The Ionic Framework provides over 100 UI Components that web developers can use in their favorite frameworks (Angular, React, or Vue) to compose beautiful, performant UI experiences for iOS, Android, Web, and Desktop.
Creating Simple Basic Grid in Ionic Let us create a simple basic grid inside the Ionic tab, go to tab1. page. html and replace the following code with ion-content. You can see in the example above we placed the Columns horizontally within the row, and it is quickly adjusting as per the available space inside the row.
You could decide how the layout is going to be shown by using the platform
information:
Platform Name Description
android on a device running Android.
cordova on a device running Cordova.
core on a desktop device.
ios on a device running iOS.
ipad on an iPad device.
iphone on an iPhone device.
mobile on a mobile device.
mobileweb in a browser on a mobile device.
phablet on a phablet device.
tablet on a tablet device.
windows on a device running Windows.
By using the underlying platform
information you could show or hide things if its a tablet
(or an ipad
) by just simply doing:
this.isTabletOrIpad = this.platform.is('tablet') || this.platform.is('ipad');
And then by using *ngIf
or whatever you need in your views, or using that isTabletOrIpad
property to decide whether to initialize the map or not.
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