@edux-design/flex
v0.0.1
Published
Lightweight Flexbox primitives with a declarative API, implemented using Tailwind utility classes and small inline styles when useful. Pairs well with `@edux-design/grid` when you need granular control for non-grid layouts.
Readme
@edux-design/flex
Lightweight Flexbox primitives with a declarative API, implemented using Tailwind utility classes and small inline styles when useful. Pairs well with @edux-design/grid when you need granular control for non-grid layouts.
Install
npm i @edux-design/flexUsage
import { Flex, FlexItem } from "@edux-design/flex";
export function Example() {
return (
<Flex gap={12} alignItems="center" justifyContent="between">
<FlexItem>Left</FlexItem>
<FlexItem grow>Growy middle</FlexItem>
<FlexItem>Right</FlexItem>
</Flex>
);
}API
Flex
direction?: 'row'|'row-reverse'|'column'|'column-reverse'— defaultrow.wrap?: 'nowrap'|'wrap'|'wrap-reverse'— defaultwrap.alignItems?: 'start'|'center'|'end'|'stretch'|'baseline'.justifyContent?: 'start'|'center'|'end'|'around'|'between'|'evenly'.alignContent?: 'start'|'center'|'end'|'around'|'between'|'evenly'|'stretch'.gap?: number|string— number interpreted as px using Tailwind arbitrary valuegap-[<n>px].inline?: boolean— inline flex container.debug?: boolean— outlines container boxes.as?: ElementType— render as custom element, defaultdiv.
FlexItem
grow?: boolean|number— boolean maps to1; number maps toflex-grow: n.shrink?: boolean|number— boolean maps to1; number maps toflex-shrink: n.basis?: string|number— number interpreted as px, string passed verbatim (e.g."50%").alignSelf?: 'start'|'center'|'end'|'stretch'|'baseline'.order?: number— sets ordering among siblings.as?: ElementType— defaultdiv.debug?: boolean— outlines item boxes.
Notes
- Tailwind responsive utilities can be composed via
classNameas needed. - Arbitrary values are used for
gapandbasisso you don’t need to extend Tailwind config.
