0.2.2 • Published 2 years ago
@qatalog/react-flex v0.2.2
@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
Flexwhich 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
gapCSS property by usingmarginCSS 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-contentalignItems: Value for CSS style propertyalign-itemsjustifyContent: Value for CSS style propertyjustify-contentdirection: Value for CSS style propertyflex-directionwrap: Value for CSS style propertyflex-wrapinline: Extrapolates value for CSS style propertydisplay. Defaults tofalse.false: Value isflextrue: Value isinline-flex
gap: Value of gap between children inpxunits. Defaults to0. UsesgapCSS 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.