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

add support for flexboxes? #182

Closed
SpaceCat-Chan opened this issue Apr 9, 2021 · 12 comments
Closed

add support for flexboxes? #182

SpaceCat-Chan opened this issue Apr 9, 2021 · 12 comments
Labels
enhancement New feature or request layout Layout engine issues and enhancements

Comments

@SpaceCat-Chan
Copy link
Contributor

flexboxes allow much easier creation of certain things, like elements that take all remaining horizontal space

are you planning on supporting flexboxes?

@mikke89
Copy link
Owner

mikke89 commented Apr 10, 2021

First of all, did you try the RCSS tables support? We support flexible sizing there as an extension over CSS, so that might be enough to suit your needs.

I understand flexbox might be convenient in some situations. However, it's also a fairly complex feature that adds 12 new RCSS properties, and then we might also want to add grid support which is something like 15 additional properties.

I think our flexible size tables will cover many needs from flex boxes, so this is not a priority for me personally, their complexity to benefit ratio is too high as I see it. However, if someone comes up with a PR of a clean implementation of flexboxes, I'm happy to add it to the library.

@mikke89 mikke89 added the enhancement New feature or request label Apr 10, 2021
@SpaceCat-Chan
Copy link
Contributor Author

i don't fully understand how to use the flexible sizing extension, could you point me to an example?

@Dakror
Copy link
Contributor

Dakror commented Apr 11, 2021

Check the documentation regarding the width & height calculation algorithm. This is more advanced than regular tables and you can create complex grids with it: https://mikke89.github.io/RmlUiDoc/pages/rcss/tables.html

Check here for the fr unit: https://css-tricks.com/introduction-fr-css-unit/

@mikke89
Copy link
Owner

mikke89 commented Apr 11, 2021

So in essence, flexible size is achieved by using width ≥ 100%. A very basic example would be something like

<table>
<td width="150px">A</td>
<td width="100%">B</td>
<td width="200%">C</td>
</table>

Now column A is fixed at 150px wide, and column B and C fills the rest of the width, with C being twice the size of B.

@SpaceCat-Chan
Copy link
Contributor Author

what if i don't know the width of A but i still want it to be minimum width?

@mikke89
Copy link
Owner

mikke89 commented Apr 12, 2021

Hm, in that case I don't think there is an easy solution in pure RCSS. You could work around it using C++ to get the width first, but it's not a pretty solution.

@mikke89
Copy link
Owner

mikke89 commented May 9, 2021

Alright, there has been quite a lot of requests for flexbox from several users, and I'm all for adding it at this point. This one might take a while though, unless somebody wants to beat me to it? :)

@paulocoutinhox
Copy link

Nice! Thanks for the great work man!

@mnba
Copy link

mnba commented Aug 6, 2021

@mikke89 Can you please occassionally, like once in 3/few months, inform us on the news? About flexbox in RmlUI. Thanks.

@mikke89
Copy link
Owner

mikke89 commented Aug 6, 2021

I appreciate the interest, but there isn't really much news on this feature. I haven't found the time yet to really dive into this, only been tinkering briefly with it.

@mikke89 mikke89 mentioned this issue Nov 20, 2021
@mikke89
Copy link
Owner

mikke89 commented Nov 21, 2021

Hey guys, after working on this for some time now, I've opened a pull request #257 implementing flexbox layout.

I think it's pretty close now, but I could need some help with testing. Let me know how it works in your use cases, cheers!

@mikke89 mikke89 added the layout Layout engine issues and enhancements label Dec 5, 2021
@mikke89
Copy link
Owner

mikke89 commented Dec 5, 2021

Alright, flexbox layout #257 is done and merged into master :)

Closing this one, please open new issues if you discover problems with the implementation.

@mikke89 mikke89 closed this as completed Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request layout Layout engine issues and enhancements
Projects
None yet
Development

No branches or pull requests

5 participants