Package Exports
- evokit-box
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (evokit-box) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
EvoKit - Box
The content block allows to apply indents, position and more. Contains one element <Box>
Install
npm install evokit-box --saveUsage
More about usage
import React from 'react';
import { Box } from 'evokit-box';
import 'evokit-box/style.css';
const App = () => (
<Box box-margin='xs xl'>
...
</Box>
);Props
Also supports other valid props of the React Element. More about use props
<Box />
| Prop name | Default value | Possible value | Description |
|---|---|---|---|
| box-align | none |
none left center right |
Horizontal alignment |
| box-background | null |
Create theme | Background color |
box-border * |
null |
Create theme | Border color, width and style |
box-border-color * |
null |
Create theme | Border color |
box-border-width * |
none |
none xxs xs s m l xl xxl |
Border width |
box-border-style * |
solid |
solid dotted dashed |
Border style |
| box-display | block |
block inline-block inline none |
Display type |
| box-height | auto |
auto 1-1 |
Set the height |
box-margin * |
none |
none xxs xs s m l xl xxl auto |
Indent around block |
box-overflow * |
visible |
auto hidden scroll visible |
Display overflow block content |
box-padding * |
none |
none xxs xs s m l xl xxl |
Indent around an block content |
| box-place | null |
top top-left top-right center center-left center-right bottom bottom-left bottom-right |
Position place |
| box-position | static |
static relative absolute fixed |
Positioning method |
box-round * |
none |
none full xxs xs s m l xl xxl |
Corner rounding |
| box-tag | div |
HTML tags | HTML tag |
| box-width | auto |
auto 1-1 *-2 *-3 *-4 *-5 *-6 *-7 *-8 *-9 *-10 |
Set the width |
*— prop has advanced params
Customize
This set of css variables is default, if you want to override one or more value, please use the rules css-variable-usage, define them below the css import.
@custom-media --ek-box-media-small only screen and (min-width: 480px);
@custom-media --ek-box-media-medium only screen and (min-width: 768px);
@custom-media --ek-box-media-large only screen and (min-width: 960px);
@custom-media --ek-box-media-wide only screen and (min-width: 1200px);
@custom-media --ek-box-media-huge only screen and (min-width: 1400px);
:root {
/* prop 'box-padding', 'box-margin' */
--ek-box-indent-xxs: 5px;
--ek-box-indent-xs: 10px;
--ek-box-indent-s: 15px;
--ek-box-indent-m: 20px;
--ek-box-indent-l: 25px;
--ek-box-indent-xl: 30px;
--ek-box-indent-xxl: 35px;
/* prop 'box-round' */
--ek-box-round-xxs: 2px;
--ek-box-round-xs: 4px;
--ek-box-round-s: 6px;
--ek-box-round-m: 8px;
--ek-box-round-l: 10px;
--ek-box-round-xl: 12px;
--ek-box-round-xxl: 14px;
/* prop 'box-border-width' */
--ek-box-border-width-xxs: 1px;
--ek-box-border-width-xs: 2px;
--ek-box-border-width-s: 3px;
--ek-box-border-width-m: 4px;
--ek-box-border-width-l: 5px;
--ek-box-border-width-xl: 6px;
--ek-box-border-width-xxl: 7px;
}Live demo
box-tag
Default value div
<Box box-tag='div'>
...
</Box>box-display
block- shown as blockyblock-inline- block element that is wrapped around by other elementsinline- displayed as inlinenone- remove from a document
<Box box-display='none'>
...
</Box>box-align
none- No alignmentleft- Align to the leftcenter- Center alignmentright- Align to the right
<Box box-align='center'>
...
</Box>box-margin
The property allows you to set the indentation value for all sides of an element at once or to determine it only for specified sides.
!> DEPRECATED props box-margin-lr and box-margin-tb, please use multi values
Advanced props
box-margin-top{1}box-margin-right{2}box-margin-bottom{3}box-margin-left{4}
Multi values (set value separated by a space)
box-margin="{1,3} {2,4}"box-margin="{1} {2,4} {3}"box-margin="{1} {2} {3} {4}"
List of values
| Value | CSS var | CSS value |
|---|---|---|
none |
--- | 0px |
auto |
--- | auto |
xxs |
--ek-box-indent-xxs |
5px |
xs |
--ek-box-indent-xs |
10px |
s |
--ek-box-indent-s |
15px |
m |
--ek-box-indent-m |
20px |
l |
--ek-box-indent-l |
25px |
xl |
--ek-box-indent-xl |
30px |
xxl |
--ek-box-indent-xxl |
35px |
<Box box-margin='s' />
<Box box-margin='s m' />
<Box box-margin='s m l' />
<Box box-margin='s m l xl' />
<Box
box-margin-top='s'
box-margin-right='m'
box-margin-bottom='l'
box-margin-left='xl'
/>box-padding
The property allows you to set the indentation value for all sides of an element at once or to determine it only for specified sides.
!> DEPRECATED props box-padding-lr and box-padding-tb, please use multi values
Advanced props
box-padding-top{1}box-padding-right{2}box-padding-bottom{3}box-padding-left{4}
Multi values (set value separated by a space)
box-padding="{1,3} {2,4}"box-padding="{1} {2,4} {3}"box-padding="{1} {2} {3} {4}"
List of values
| Value | CSS var | CSS value |
|---|---|---|
none |
--- | 0px |
xxs |
--ek-box-indent-xxs |
5px |
xs |
--ek-box-indent-xs |
10px |
s |
--ek-box-indent-s |
15px |
m |
--ek-box-indent-m |
20px |
l |
--ek-box-indent-l |
25px |
xl |
--ek-box-indent-xl |
30px |
xxl |
--ek-box-indent-xxl |
35px |
<Box box-padding='s' />
<Box box-padding='s m' />
<Box box-padding='s m l' />
<Box box-padding='s m l xl' />
<Box
box-padding-top='s'
box-padding-right='m'
box-padding-bottom='l'
box-padding-left='xl'
/>box-round
The property allows you to set the fillet value for all corners of the element at the same time or to determine it only for the specified angle.
!> DEPRECATED props box-round-top, box-round-right, box-round-bottom and box-round-left, please use multi values
Advanced props
box-round-top-left{1}box-round-top-right{2}box-round-bottom-right{3}box-round-bottom-left{4}
Multi values (set value separated by a space)
box-round="{1,3} {2,4}"box-round="{1} {2,4} {3}"box-round="{1} {2} {3} {4}"
List of values
| Value | CSS var | CSS value |
|---|---|---|
none |
--- | 0px |
full |
--- | 50% |
xxs |
--ek-box-round-xxs |
2px |
xs |
--ek-box-round-xs |
4px |
s |
--ek-box-round-s |
6px |
m |
--ek-box-round-m |
8px |
l |
--ek-box-round-l |
10px |
xl |
--ek-box-round-xl |
12px |
xxl |
--ek-box-round-xxl |
14px |
<Box box-round='s' />
<Box box-round='s m' />
<Box box-round='s m l' />
<Box box-round='s m l xl' />
<Box
box-round-top-left='s'
box-round-top-right='m'
box-round-bottom-right='l'
box-round-bottom-left='xl'
/>box-width
auto- value:auto- See table, for example:
3-4=75%
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 100% |
50% |
33.33% |
25% |
20% |
16.66% |
14.28% |
12.5% |
11.11% |
10% |
| 2 | --- | 100% |
66.66% |
50% |
40% |
33.33% |
28.57% |
25% |
22.22% |
20% |
| 3 | --- | --- | 100% |
75% |
60% |
50% |
42.85% |
37.5% |
33.33% |
30% |
| 4 | --- | --- | --- | 100% |
80% |
66.66% |
57.14% |
50% |
44.44% |
40% |
| 5 | --- | --- | --- | --- | 100% |
83.33% |
71.42% |
62.5% |
55.55% |
50% |
| 6 | --- | --- | --- | --- | --- | 100% |
85.71% |
75% |
66.66% |
60% |
| 7 | --- | --- | --- | --- | --- | --- | 100% |
87.5% |
77.77% |
70% |
| 8 | --- | --- | --- | --- | --- | --- | --- | 100% |
88.88% |
80% |
| 9 | --- | --- | --- | --- | --- | --- | --- | --- | 100% |
90% |
| 10 | --- | --- | --- | --- | --- | --- | --- | --- | --- | 100% |
<Box box-width='3-4'>
...
</Box>box-height
auto- value:auto1-1- value:100%
<Box box-height='1-1'>
...
</Box>box-position
<Box box-position='absolute'>
...
</Box>box-place
Use with prop
box-position
<Box box-position='absolute' box-place='center'>
...
</Box>box-overflow
The property allows you to set the value for all axes at the same time or to determine it only for the specified axis
Advanced props
box-overflow-x{1}box-overflow-y{2}
Multi values (set value separated by a space)
box-overflow="{1} {2}"
List of values
auto- Scroll bars are added only when neededhidden- Only the area inside the element is displayed, the rest will be hiddenscroll- Scroll bars are always addedvisible- The entire content of the element is displayed, even beyond the specified height and width
<Box box-overflow='scroll' />
<Box box-overflow='visible scroll' />
<Box box-overflow-x='visible' box-overflow-y='scroll' />box-border
!> DEPRECATED props box-border-lr and box-border-tb, please use the separately box-border-left and box-border-right or box-border-top and box-border-bottom
Advanced props
box-border-topbox-border-rightbox-border-bottombox-border-left
Multi values (set value separated by a space)
box-border="{1}"box-border="{1} {2}"box-border="{1} {2} {3}"
<Box box-border="{THEME_NAME}" />
<Box box-border="{THEME_NAME} xs" />
<Box box-border="{THEME_NAME} xs dotted" />
<Box box-border-top="{THEME_NAME}" />
<Box box-border-top="{THEME_NAME} xs" />
<Box box-border-top="{THEME_NAME} xs dotted" />Set the
THEME_NAMEdepending on the theming
box-border-width
The property allows you to set the border width for all sides of an element at once or to determine it only for specified sides.
Advanced props
box-border-width-top{1}box-border-width-right{2}box-border-width-bottom{3}box-border-width-left{4}
Multi values (set value separated by a space)
box-border-width="{1,3} {2,4}"box-border-width="{1} {2,4} {3}"box-border-width="{1} {2} {3} {4}"
List of values
| Value | CSS var | CSS value |
|---|---|---|
none |
--- | 0px |
xxs |
--ek-box-border-width-xxs |
1px |
xs |
--ek-box-border-width-xs |
2px |
s |
--ek-box-border-width-s |
3px |
m |
--ek-box-border-width-m |
4px |
l |
--ek-box-border-width-l |
5px |
xl |
--ek-box-border-width-xl |
6px |
xxl |
--ek-box-border-width-xxl |
7px |
<Box box-border-width='s' />
<Box box-border-width='s m' />
<Box box-border-width='s m l' />
<Box box-border-width='s m l xl' />
<Box
box-border-width-top='s'
box-border-width-right='m'
box-border-width-bottom='l'
box-border-width-left='xl'
/>box-border-color
The property allows you to set the border color for all sides of an element at once or to determine it only for specified sides.
Advanced props
box-border-color-top{1}box-border-color-right{2}box-border-color-bottom{3}box-border-color-left{4}
Multi values (set value separated by a space)
box-border-color="{1,3} {2,4}"box-border-color="{1} {2,4} {3}"box-border-color="{1} {2} {3} {4}"
<Box box-border-color='{THEME_NAME}' />
<Box box-border-color='{THEME_NAME} {THEME_NAME}' />
<Box box-border-color='{THEME_NAME} {THEME_NAME} {THEME_NAME}' />
<Box box-border-color='{THEME_NAME} {THEME_NAME} {THEME_NAME} {THEME_NAME}' />
<Box
box-border-color-top='{THEME_NAME}'
box-border-color-right='{THEME_NAME}'
box-border-color-bottom='{THEME_NAME}'
box-border-color-left='{THEME_NAME}'
/>Set the
THEME_NAMEdepending on the theming
box-border-style
The property allows you to set the border style for all sides of an element at once or to determine it only for specified sides.
Advanced props
box-border-style-top{1}box-border-style-right{2}box-border-style-bottom{3}box-border-style-left{4}
Multi values (set value separated by a space)
box-border-style="{1,3} {2,4}"box-border-style="{1} {2,4} {3}"box-border-style="{1} {2} {3} {4}"
Values
solid- solid style (default)dotted- dotted styledashed- dashed style
<Box box-border-style='solid' />
<Box box-border-style='solid dotted' />
<Box box-border-style='solid dotted dashed' />
<Box box-border-style='solid dotted dashed solid' />
<Box
box-border-style-top='solid'
box-border-style-right='dotted'
box-border-style-bottom='dashed'
box-border-style-left='solid'
/>box-background
<Box box-background='{THEME_NAME}'>
...
</Box>Set the
THEME_NAMEdepending on the theming