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.
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.
| Name | Type | Default | Description |
|---|---|---|---|
background | ReactNode | – | Replaces the CSS background: UI, a photo. Decorative: hidden from assistive technology. |
description | ReactNode | – | |
headingLevel | 2 | 3 | 4 | 3 | The title's level. |
render | RenderProp<Record<string, never>> | – | Must render an |
size | "wide" | "square" | "tall" | 'square' | The tile's shape in the grid: wide, square or tall. |
titlerequired | ReactNode | – |
- Also takes every attribute of
<article>exceptchildren,title. (Omit<ComponentPropsWithRef<"article">, "title" | "children">)
render takes an element, or, in client code, a function of the props and no state.
Other exports
BentoTilePropstypeimport 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.
| Slot | Rendered by | Data attributes |
|---|---|---|
bento-tile.nz-bento-tile | BentoTileroot (takes render) |
|
bento-tile-title.nz-bento-tile-title | BentoTileinner 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.
Banner
A page-wide message under the header, one at a time, with a title, a line of text, one action and an optional dismiss. Server-rendered; only the dismiss button hydrates.
Breadcrumb
Where the page sits in the site, as a navigation landmark of links around an ordered list. The last level is the current page, as text with aria-current="page"; a router's link goes in through each item's render.