Inline
Children in a row, centred on the cross axis, wrapping onto new lines when they do not fit.
Import
import { Inline } from '@nizivo/react/inline';
// Once per app (Getting started), after
// @nizivo/tokens/tokens.css and @nizivo/react/css/base.css
import '@nizivo/react/css/inline.css';Static or interactive
Server. It ships no client JavaScript when a Server Component renders it, in every Next.js build
mode; its code is bundled only when a client component (a 'use client' file) imports it. How to
choose.
In a client app (a Vite or React Router single-page app, or a 'use client' file) it is an ordinary React component: event handlers, refs and state work as usual. In a client app.
Examples
Basic
import type { JSX } from 'react';
import { Button } from '@nizivo/react/button';
import { Inline } from '@nizivo/react/inline';
export function InlineExample(): JSX.Element {
return (
<Inline gap="2">
<Button variant="primary">Save</Button>
<Button>Cancel</Button>
</Inline>
);
}
Props
Children in a row, centred on the cross axis, wrapping onto new lines when they do not fit.
Server component Renders data-slot="inline" with the class nz-inline. Props: InlineProps. Source: src/inline/inline.tsx.
| Name | Type | Default | Description |
|---|---|---|---|
gap | LayoutGap"0""0-5""1""1-5""2""3""4""5""6""8""10""12""16""20""24" | – | Space between children, on both axes when they wrap. Absent, there is none. |
render | RenderProp<InlineState> | – | Another element, for example |
- Also takes every attribute of
<div>. (ComponentPropsWithRef<"div">)
render takes an element, or, in client code, a function of the props and this state (InlineState):
| Name | Type | Default | Description |
|---|---|---|---|
gaprequired | LayoutGap | undefined"0""0-5""1""1-5""2""3""4""5""6""8""10""12""16""20""24" | – |
Other exports
InlinePropstypeimport type { InlineProps } from '@nizivo/react/inline'The props of
Inline, listed above.InlineStatetypeimport type { InlineState } from '@nizivo/react/inline'The render state of
Inline, listed above.
Data attributes and slots
Style parts by class (.nz-<slot>) and state by data attribute. Attribute meanings come from contracts/vocabulary.json.
| Slot | Rendered by | Data attributes |
|---|---|---|
inline.nz-inline | Inlineroot (takes render) |
|
CSS hooks
Set a hook on the component's class or any ancestor to restyle it without specificity games; leave it unset for the default shown.
| Hook | Default | Read as |
|---|---|---|
--nz-inline-gap |
|
|
Layers: nz.components. Classes: .nz-inline.
Tokens this stylesheet reads (15)
--nz-space-0, --nz-space-0-5, --nz-space-1, --nz-space-1-5, --nz-space-10, --nz-space-12, --nz-space-16, --nz-space-2, --nz-space-20, --nz-space-24, --nz-space-3, --nz-space-4, --nz-space-5, --nz-space-6, --nz-space-8
Accessibility
Nothing in this component takes focus or keyboard input.
Keyboard
None.
Figma
Node ids from design/component-map.json, which nz gen writes from component.json. The links open the Nizivo Figma library, which may ask you to sign in.
- Canonical: none
- Ghost masters: none