Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat request: make grid responsive by screen size #6050

Closed
Bandito11 opened this issue Apr 5, 2016 · 13 comments · Fixed by #10485
Closed

feat request: make grid responsive by screen size #6050

Bandito11 opened this issue Apr 5, 2016 · 13 comments · Fixed by #10485
Assignees
Milestone

Comments

@Bandito11
Copy link

Hi,

This is not an issue more of a suggestion. I am doing a Windows 10 desktop app, and I was thinking "If I decided to do an app that worked for desktop and mobile I would have to make the grid work on different screen sizes".

So my suggestion is that the grid works on different screen sizes like:

width for mobile: width < 600px
width-m for tablets: width > 600px
width-L for Desktops: width > 1200px

or something similar. Same with the offsets.

@adamdbradley
Copy link
Contributor

These sizes should be configurable. Specifically which lines of code would you liked changed?

@Bandito11
Copy link
Author

No I know how to do that. (In fact I think you guys did it in a similar way I did in the past in sass). I've meant like add it to a future installment.

@adamdbradley
Copy link
Contributor

Do you mean for ionic1 or ionic2? So far these numbers have been working great for us: https://github.com/driftyco/ionic/blob/2.0/ionic/components/grid/grid.scss#L13

@Bandito11
Copy link
Author

This would be for ionic 2. I don't meant to change it, but like add option so that the grid is implemented for different sizes. Like this grid will be implemented if the screen size is large.

In other words if I do this:
d for desktop and t for tablet

<ion-row>
<ion-col d-width-10 t-width-30>
<ion-input></ion-input>
</ion-col>
</ion-row>

The grid will just act different depending on the screen size.

@brandyscarney brandyscarney self-assigned this Apr 29, 2016
alan-agius4 added a commit to alan-agius4/ionic that referenced this issue Aug 14, 2016
#### Short description of what this resolves:
Implement responsive columns widths in a grid. Similar to other frameworks.

#### Changes proposed in this pull request:

- Implement responsive column
- Add an attribute of X-width-10 to a column will trigger the width to be 10% for that breakpoint Ex: `<ion-col lg-width-25 sm-width-50 width-100></ion-col>`

**Ionic Version**: 2

**Fixes**: ionic-team#6050
@jgw96 jgw96 closed this as completed Sep 2, 2016
@jgw96 jgw96 reopened this Sep 2, 2016
@dylanvdmerwe
Copy link
Contributor

As per my suggestion else where, I believe Ionic's grid needs to be enhanced at some point in the future. I would highly recommend basing it off something like bootstrap 4.

@brandyscarney brandyscarney changed the title Grid feat request: make grid responsive by screen size Jan 17, 2017
@mikewagz
Copy link

+1 for a responsive grid system a la Bootstrap!

@brandyscarney
Copy link
Member

@mikewagz Please add a thumbs up on the original comment, we can sort issues by these. :)

@seanmavley
Copy link

@brandyscarney I came across this answer: http://stackoverflow.com/questions/36018146/ionic-2-responsive-grid

Is there somewhere in the ionic 2 docs that mention the use of the responsive-sm attributes?

@brandyscarney
Copy link
Member

@seanmavley Unfortunately it probably isn't documented. I am currently working on improving the grid system and with the improvements I'll be writing new documentation for it. I'll update this issue once I have something for you all to try. Thanks!

brandyscarney added a commit that referenced this issue Feb 14, 2017
brandyscarney added a commit that referenced this issue Feb 14, 2017
brandyscarney added a commit that referenced this issue Feb 14, 2017
@brandyscarney
Copy link
Member

Hey everyone, I have been working on the new grid system based on Bootstrap 4. Here is a stand alone example of it: grid.zip

I've released a nightly if you'd like to try it out, using this nightly should still work with the old system:

npm install --save ionic-angular@2.0.1-201702142221

And here is a document (a work in progress) where I have written up some information on it: Ionic Grid API

The old grid system will eventually go away, but for now it should still work. If you see your current grid completely break or if you have feedback on the new system please let me know. Thanks! :)

@mikewagz
Copy link

mikewagz commented Feb 15, 2017

@brandyscarney - I really appreciate the work you're doing on the grid system, it has the potential to make Ionic much more flexible for various devices. I personally can't wait to upgrade our startup's iPad version to take advantage of this.

I checked out the doc you posted and had a question with how you're implementing the columns. If we're going for Bootstrap-style syntax, I'm not sure how to interpret the example:

<ion-col col-12 col-sm>col</ion-col>

Wouldn't it make more sense to have the various column specifiers by screen width, such as:

<ion-col col-sm-12 col-md-6 col-lg-4>

This example would indicate a 100%-column on small screen, 50%-column on medium screens, and a 33%-column on large screens. Also, offsets would accompany these if needed, like:

<ion-col col-sm-12 col-md-6 col-offset-md-3>

This example would be a full row on small screens and a centered 50% column on anything larger.

This methodology seems like the way we're all used to using a grid, as popularized by Bootstrap, Materialize etc. Any chance that is desirable/doable?

Thanks for building an awesome framework!

EDIT: After looking at the .zip it looks like this is how it is implemented, with the col-* being the default "xs" size and the col-smet al being a flex-grid equal-width column. I like it!

@brandyscarney
Copy link
Member

@mikewagz I'm glad you like it! To explain the following example:

<ion-col col-12 col-sm>col</ion-col>

I am adding col-12 so that it will take up 100% width from xs screens up, and then col-sm will change back to auto or equal width columns for sm screens and up. This is a replacement for our responsive-sm attribute. I just wanted to make sure it was still possible to do everything our old grid could do in our new grid.

Thanks for the feedback. :)

@brandyscarney brandyscarney added this to the 2.1.0 milestone Feb 21, 2017
brandyscarney added a commit that referenced this issue Feb 21, 2017
…0485)

The old grid is still supported but will be deprecated in the future.

closes #6050 closes #7508
@ionitron-bot
Copy link

ionitron-bot bot commented Sep 3, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants