Inline
Inline is a layout component to control the horizontal white space between elements. Inline allows you to apply standard spacing between direct children and define the alignment of these children.
Installation
npm install @nib/layout
Usage
import {Inline} from '@nib/layout';
Do not style layout components
Interactive demo
Props
Prop | Type | Default | Description |
---|---|---|---|
space | number or object | 0 | A size from our spacing scale. Can be made responsive by passing an object of breakpoints. Value(s) must be one of 0...10 . |
collapseBelow | string | A breakpoint value which defines when the inline structure should collapse to a vertical stack. | |
align | string | left | Horizontally align the inline containers. Must be one of left , center , or right . |
verticalAlign | string | top | Vertically align the inline containers. Must be one of top , center , or bottom . |
spaceVertically | boolean | true | Whether to apply vertical spacing with the space prop value. |
Considerations
The Inline
component should be used to handle horizontal spacing between components. Mesh components should have no external margins to enable greater composibility with layout components. It is simpler, more efficient and predictable to leave the concern of spacing to a layout component than the individual children.
This component will wrap child components when required, and provide equivalent spacing between components on different rows.
Responsive
Often you will want less space between elements on mobile-sized screens than desktop. The space
prop accepts an object of breakpoints to allow responsive spacing.
<Inline space={{xs: 4, md: 6}}><PrimaryButton>Button on the left</PrimaryButton><SecondaryButton>Button on the right</SecondaryButton></Inline>