Usage

All valid HTML elements can be a child of a Split component, but SplitSection is needed to use the flex-item properties grow, shrink and basis.

import { Split, SplitSection } from '@loomhq/lens'
<Split>
  <div>Content</div>
  <SplitSection grow={1}>Content</SplitSection>
</Split>

Based on CSS flexbox

Split component is built with CSS flexbox. Learn more about CSS flexbox A Complete Guide to Flexbox.

Gap

Use gap to set both the row and column gap to the same value.

Use rowGap and/or columnGap to set independent spacing values for each axis. These values will override any values set using gap.

Align and justify

Use alignItems, alignContent, and justifyContent in the same way you would use CSS flexbox.

Grow, shrink and basis

Wrap child elements in a SplitSection container to use grow, shrink, and basis in the same way you would use CSS flexbox.

Wrap

Resize to wrap

HTML list tags

When using Split as a list, use the htmlTag prop to generate semantic list markup. All child Split and SplitSection will automatically be rendered as an <li> element. All other child elements should be wrapped in or transformed into <li> tags.

Responsive props

See available 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

breakpointmin width
xsmall31em (496px)
small48em (768px)
medium64em (1024px)
large75em (1200px)

Responsive examples

Resize the browser to see the effect.

More examples

See Layout recipes.

Props

Split

name
type
default
gap
ResponsiveType
<number | string>
'initial'
alignItems
ResponsiveType
< 'start' | 'stretch' | 'flex-start' | 'flex-end' | 'center' | 'baseline' >
'center'
wrap
ResponsiveType
<'nowrap' | 'wrap' | 'wrap-reverse'>
'wrap'
htmlTag
'div' | 'ul' | 'ol' | 'li'
'div'
width
ResponsiveType
<number | string>
height
ResponsiveType
<number | string>
minWidth
ResponsiveType
<number | string>
minHeight
ResponsiveType
<number | string>
maxWidth
ResponsiveType
<number | string>
maxHeight
ResponsiveType
<number | string>
children
React.ReactNode
justifyContent
ResponsiveType
< | 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' >
alignContent
| 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'start' | 'end' | 'baseline'
rowGap
ResponsiveType
<number | string>
columnGap
ResponsiveType
<number | string>
direction
ResponsiveType
< 'column' | 'column-reverse' | 'row' | 'row-reverse' >
className
never
style
never

SplitSection

name
type
default
htmlTag
'div' | 'li'
'div'
width
ResponsiveType
<number | string>
height
ResponsiveType
<number | string>
minWidth
ResponsiveType
<number | string>
minHeight
ResponsiveType
<number | string>
maxWidth
ResponsiveType
<number | string>
maxHeight
ResponsiveType
<number | string>
children
React.ReactNode
grow
ResponsiveType
<number | string>
shrink
ResponsiveType
<number | string>
basis
ResponsiveType
<number | string>
className
never
style
never