@qatalog/react-flex
v0.2.2
Published
A browser-agnostic flexbox component with CSS gap support
Downloads
3
Keywords
Readme
@qatalog/react-flex
- What's this?
- Why should I use this package?
- What CSS-in-JS library does this package use?
- How do I use it?
- What is the full list of props?
- What versions of Node does it support?
- Is there a changelog?
- What license is it released under?
What's this?
A browser-agnostic flexbox component with CSS gap polyfill support. Uses feature detection to ensure consistent rendering across platforms.
Why should I use this package?
There are 3 main reasons to use this package compared to other similar packages in the ecosystem.
- Simplicity: This package provides only a single component called
Flex
which renders a single DOM element with flexbox. This allows users to compose however many layers of flexboxes they want. This package also keeps the props of the component simple and straightforward. - Flexibility: This package neither assumes any responsive design logic nor hardcodes measurements. This allows users to provide these values when using the component making it usable in all scenarios.
- Compatibility: This package supports browsers that do not support
gap
CSS property by usingmargin
CSS properties and custom calculation logic. This allows users to fearlessly use the flexbox grid design everywhere.
What CSS-in-JS library does this package use?
While we do use styled-components, we are open to any contributions that makes this package independent of styling libraries.
How do I use it?
Simply import it and use it as any regular component.
import Flex from '@qatalog/react-flex';
const Button = ({}) => {
return (
<Flex direction="row" alignItems="center" wrap="wrap" gap={8}>
<div>One</div>
<div>Two</div>
</Flex>
);
};
export default Button;
What is the full list of props?
All the below props are optional.
alignContent
: Value for CSS style propertyalign-content
alignItems
: Value for CSS style propertyalign-items
justifyContent
: Value for CSS style propertyjustify-content
direction
: Value for CSS style propertyflex-direction
wrap
: Value for CSS style propertyflex-wrap
inline
: Extrapolates value for CSS style propertydisplay
. Defaults tofalse
.false
: Value isflex
true
: Value isinline-flex
gap
: Value of gap between children inpx
units. Defaults to0
. Usesgap
CSS style property if supported.as
: Renders the component as this type of DOM element. Type of prop isReact.ElementType
. Defaults todiv
.
What versions of Node does it support?
Minimum supported node version is 14
.
Is there a changelog?
Yes.
What license is it released under?
MIT.