react-flexa
react-flexa copied to clipboard
Default `xs` prop in Col component
Hey, i was wondering why isn't xs={12} set as default prop in Col.
Makes more sense to define the first breakpoint that its value is different than "12". For example instead of this
<Col xs={12} md={6}>
i could just write
<Col md={6}>
Because with no default breakpoint value i have to write xs={12} to all my components.
Hi @sstefoss ,
This is something we can look into doing (setting a default to Col). Out of the box Flexa takes the view of implementing much of the CSS Flexbox API one-to-one with no extra "magic".
As a result the components have very little defaults set to them. This helps reserve expected behavior, if we start to add various values to start with it can conflict to what people are expecting.
If you're interested I'm happy to work with you on creating a pull request to build out this functionality and test it with real world examples?
I understand. What if it was an optional property in theme? To set the default breakpoint values when nothing is specified.
I would be happy to contribute too.
That could work!
I had been thinking for a bit about setting default props via the theme provider.
So this could work as you mentioned we could set default props via the theme:
flexa: {
col: {
xs: 12,
sm: 6,
},
},
We would need to check the theme provider for the props if they exist when creating the width. This is currently done for the gutters.
@sstefoss agreed