basic-comps v1.0.0
Installation
$ yarn add basic-comps
# or
$ npm install basic-compsFeatures
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
Components
Box
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.
Default styles
display: flex;
flex-direction: column;
align-items: stretch;Props
relative:booleantype. Iftrue, it hasposition: relative.center:booleantype. Iftrue, bothalign-itemsandjustify-contentarecenter.
Example
<Box backgroundColor="gray" borderRadius={4} padding={[12, 16]}>
hello world!
</Box>Absolute, Fixed, Sticky
These are box components that have the position CSS property and related props(top, bottom, left, right, inset, zIndex, etc...).
Stacks
Both VStack and HStack are layout components used to arrange elements.
Default styles
VStack
flex-direction: column;
align-items: stretch;HStack
flex-direction: row;
align-items: center;Props
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.
Dividers
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, GridItem
Grid and GridItem are components used for grid layout.
TextGroup, Text
Text is a component used to display text elements.
Props (Text)
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.