Skip to content
Get started

Components

BentoTile

Unstable: a showcase tile for a bento grid, a background and a frosted caption card, wide, square or tall. Import it from @nizivo/react/unstable/bento-tile.

Server component, no client JSUnstable

Examples

Basic

The three sizes in a 12-column bento grid.

Light and Dark

One mode switch, every colour follows.

Accessible

Every pair passes AA.

Tokens

One set, every surface.

Motion

Calm by default.

import type { JSX } from 'react';
import { BentoTile } from '@nizivo/react/unstable/bento-tile';

export function BentoTileExample(): JSX.Element {
  return (
    <div
      style={{ display: 'grid', gridTemplateColumns: 'repeat(12, 1fr)', gap: 24, inlineSize: 960 }}
    >
      <BentoTile
        size="wide"
        title="Light and Dark"
        description="One mode switch, every colour follows."
      />
      <BentoTile size="tall" title="Accessible" description="Every pair passes AA." />
      <BentoTile size="square" title="Tokens" description="One set, every surface." />
      <BentoTile size="square" title="Motion" description="Calm by default." />
    </div>
  );
}

Import

import { BentoTile } from '@nizivo/react/unstable/bento-tile';

// Once per app (Getting started), after
// @nizivo/tokens/tokens.css and @nizivo/react/css/base.css
import '@nizivo/react/css/bento-tile.css';

Static or interactive

Server. No client JavaScript. How to choose.

Use

title (h3 by default) and description sit on the frosted caption card, never on the background. size spans the tile in a 12-column grid: wide 8 columns, square 4, tall 4 by 2 rows. background takes a screenshot or a photo, or the design's shader (ShaderSurface): <ShaderSurface /> (Aurora) on a wide tile, variant="glow-orb" on a square one and variant="contour" on a tall one; without one, CSS gradients stand in. Without backdrop blur, or with reduced transparency, the card is opaque.

Props

Server component Renders data-slot="bento-tile" with the class nz-bento-tile. Props: BentoTileProps. Source: src/unstable/bento-tile/bento-tile.tsx.

NameTypeDefaultDescription
backgroundReactNode–

Replaces the CSS background: UI, a photo. Decorative: hidden from assistive technology.

descriptionReactNode–
headingLevel2 | 3 | 43

The title's level.

renderRenderProp<Record<string, never>>–

Must render an <article>.

size"wide" | "square" | "tall"'square'

The tile's shape in the grid: wide, square or tall.

titlerequiredReactNode–
  • Also takes every attribute of <article> except children, title. (Omit<ComponentPropsWithRef<"article">, "title" | "children">)

render takes an element, or, in client code, a function of the props and no state.

Other exports

BentoTileProps type

import type { BentoTileProps } from '@nizivo/react/unstable/bento-tile'

The props of BentoTile, 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
bento-tile
.nz-bento-tile
BentoTile
root (takes render)
  • data-size: "wide""square""tall" ← size
    The size prop; values in each component manifest
bento-tile-title
.nz-bento-tile-title
BentoTile
inner element (CSS only)
none

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.

This stylesheet reads no public hook.

Layers: nz.components. Classes: .nz-bento-tile, .nz-bento-tile-background, .nz-bento-tile-caption, .nz-bento-tile-description, .nz-bento-tile-title, .nz-shader-surface.

Tokens this stylesheet reads (17)

--nz-bg-accent, --nz-bg-brand-muted, --nz-bg-brand-subtle, --nz-bg-canvas, --nz-bg-surface, --nz-font-body-m, --nz-font-heading-h3, --nz-radius-2xl, --nz-radius-xl, --nz-space-1-5, --nz-space-10, --nz-space-4, --nz-space-5, --nz-space-6, --nz-text-primary, --nz-text-secondary, --nz-tracking-heading-h3

Accessibility

Nothing in this component takes focus or keyboard input.

Keyboard

None.

On this page