Skip to content
Mesh
1.6.0

Inline

Inline is a layout component to control the horizontal white space between elements. Inline allows you to apply standard between direct children and define the alignment of these children.

Installation

bash
npm install @nib/layout

Usage

jsx
import {Inline} from '@nib/layout';

Do not style layout components

You must not apply styled-components to this component as it will interfere with the structure required for the current styling. This is true for all layout components.

Interactive demo

jsx

Props

PropTypeDefaultDescription
space (required)number or objectA size from our spacing scale. Can be made responsive by passing an object of breakpoints. Value(s) must be one of 1...10.
collapseBelowstringA breakpoint value which defines when the inline structure should collapse to a vertical stack.
alignstringleftHorizontally align the inline containers. Must be one of left, center, or right.
verticalAlignstringtopVertically align the inline containers. Must be one of top, center, or bottom.

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.

jsx
<Inline space={{xs: 4, md: 6}}>
<PrimaryButton>Button on the left</PrimaryButton>
<SecondaryButton>Button on the right</SecondaryButton>
</Inline>