Usage
import { Spacer } from '@loomhq/lens'
<Spacer bottom="medium">Content</Spacer>
Spacing
Use left
right
top
bottom
props to create space between components. These props can accept 3 types of values:
Semantic spacing value
This is the most recommended option.
<Spacer left="small" right="large">Content</Spacer>
name | unit | rem | px |
---|---|---|---|
xsmall | 0.5 | 0.25rem | 4px |
small | 1 | 0.5rem | 8px |
medium | 2 | 1rem | 16px |
large | 3 | 1.5rem | 24px |
xlarge | 5 | 2.5rem | 40px |
xxlarge | 8 | 4rem | 64px |
Number value
<Spacer left={1} right={3}>Content</Spacer>
The number value will be mutiplied by 8
.
For example, if we pass 3
it will result in 24px
(3*8
).
The result is converted to REMs
, so the final value is 1.5rem
(24/16
).
String value
Any valid CSS measurement value, for example, 1rem
, 50%
, or 10vw
.
<Spacer right="1rem">Content</Spacer>
Responsive props
For responsive props pass an object where the key is the min-width
breakpoint.
prop={{
default: 'xsmall',
xsmall: 'xsmall',
small: 'xsmall',
medium: 'large',
large: 'xlarge',
}}
Custom breakpoint
prop={{
'12em': 'xsmall',
'28em': 'large',
}}
Available breakpoints
breakpoint | min width |
---|---|
xsmall | 31em (496px) |
small | 48em (768px) |
medium | 64em (1024px) |
large | 75em (1200px) |
Responsive examples
Resize the browser to see the effect.
Props
name
type
default
isInline
boolean
children
React.ReactNode