$ yarn add basic-comps
# or
$ npm install basic-comps-
By default, all components are
display:flex. Therefore, all components follow the flexbox layout. -
Sizetype props(such aswidth,height,marginTop,fontSize, etc...) accept a number type. If a value inpxis inputted, it will be internally converted toremvalues. For example, if the input is20, it will be converted to1.25rem. In the future, I plan to make it configurable both the input and output units. -
Spacingprops(such aspadding,margin) can accept several different types.string: It is passed without any changes or modificationsSize: It applied to all sides (top, bottom, left, right)[Size, Size]: top/bottom | left/right[Size, Size, Size]: top | left/right | bottom[Size, Size, Size, Size]: top | right | bottom | left
Box component is the most basic component. It can accept most CSS properties, excluding paragraph and grid-related ones, and can be used to create a "box" as the name suggests.
display: flex;
flex-direction: column;
align-items: stretch;relative:booleantype. Iftrue, it hasposition: relative.center:booleantype. Iftrue, bothalign-itemsandjustify-contentarecenter.
<Box backgroundColor="gray" borderRadius={4} padding={[12, 16]}>
hello world!
</Box>These are box components that have the position CSS property and related props(top, bottom, left, right, inset, zIndex, etc...).
Both VStack and HStack are layout components used to arrange elements.
VStack
flex-direction: column;
align-items: stretch;HStack
flex-direction: row;
align-items: center;spacing:Sizetype. It sets the spacing of items aligned on main axis.crossSpacing:Sizetype. It sets the spacing of items aligned on cross axis. It only works when theflexWrap(#) prop is set.- reference: The two axes of flexbox
reversed:booleantype. It specifies the stack direction is reversed.
VDivider and HDivider are components that used to visually separate elements. It is the only component that does not inherit from the Box component.
Grid and GridItem are components used for grid layout.
Text is a component used to display text elements.
lineThrough:booleantype. Iftrue, it hastext-decoration: line-through.underline:booleantype. it hastext-decoration: underline.ellipsisLines:numbertype. It contains some styles fortext-overflow: ellipsis. The text is clipped to the number of lines specified byellipsisLines, and ellipsis is applied.