Skip to content
Nizivo UI

Inline

Children in a row, centred on the cross axis, wrapping onto new lines when they do not fit.

Server component, no client JS

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.

NameTypeDefaultDescription
gapLayoutGap
"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.

renderRenderProp<InlineState>–

Another element, for example render={<ul />} for a list.

  • 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):

NameTypeDefaultDescription
gaprequiredLayoutGap | undefined
"0""0-5""1""1-5""2""3""4""5""6""8""10""12""16""20""24"
–

Other exports

InlineProps type

import type { InlineProps } from '@nizivo/react/inline'

The props of Inline, listed above.

InlineState type

import 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.

SlotRendered byData attributes
inline
.nz-inline
Inline
root (takes render)
  • data-gap: "0""0-5""1""1-5""2""3""4""5""6""8""10""12""16""20""24" ← gap
    The gap prop: a --nz-space-* step; values in each component manifest

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.

HookDefaultRead as
--nz-inline-gap
  • default: 0
  • data-gap="0": var(--nz-space-0)
  • data-gap="0-5": var(--nz-space-0-5)
  • data-gap="1": var(--nz-space-1)
  • data-gap="1-5": var(--nz-space-1-5)
  • data-gap="10": var(--nz-space-10)
  • data-gap="12": var(--nz-space-12)
  • data-gap="16": var(--nz-space-16)
  • data-gap="2": var(--nz-space-2)
  • data-gap="20": var(--nz-space-20)
  • data-gap="24": var(--nz-space-24)
  • data-gap="3": var(--nz-space-3)
  • data-gap="4": var(--nz-space-4)
  • data-gap="5": var(--nz-space-5)
  • data-gap="6": var(--nz-space-6)
  • data-gap="8": var(--nz-space-8)
  • gap on .nz-inline

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

On this page