Open skrat opened 9 years ago
@skrat h-box
and v-box
are a layer over flexbox but they don't have direct support for wrapping. It hasn't ever been on our radar.
Untested: you might be able to add a flexbox :style
to an h-box
like {:flex-wrap: "wrap"}
.
I just came up against this as well. It seems that adding :style {:flex-wrap "wrap"}
doesn't work, because h-box
and v-box
use :flex-flow "row|column no-wrap"
, and :flex-flow
takes precedence over a separate :flex-wrap
declaration.
Of course, it's possible to pass :style {:flex-flow "row|column wrap"}
as appropriate, but this feels a little silly; h-box
and v-box
already have row|column
specified, so we're duplicating work there. Admittedly, it's not a lot of work, but it makes it more cumbersome to pass around style maps that you might want to share between h-box
and v-box
components.
I see two options here (aside from not doing anything and letting us hack around it):
:wrap
option to these componentsv-box
and h-box
specify separate :flex-direction
and default :flex-wrap
separately, so that the user can override :flex-wrap
through the :styles
map, as you suggest.While the former might look nice, the latter might lead to better composability using style maps.
This is still an issue and I vote for having :wrap
as a keyword argument for these layout components.
I have created a PR #312 which should fix this issue. The PR allows users to use :wrap
keyword in h-box
and v-box
.
In the case that :wrap
keyword is not passed to re-com, the default of nowrap
remains to avoid breaking changes for current use cases.
I'm trying to figure out how to make a list item, that displays it's children horizontally when there's enough space (desktop), but wraps them into multiple "lines" when there isn't (mobile). Am I missing something or is this simply not possible with the built-in
h-box
/v-box
? Is re-com missing some layout component that would do this for me? I'm new to bootstrap but I tried to userow
andcol-md-4
classes to no avail. Apparently they don't work when I useinput-text
components.