Components
FeatureCard
Unstable: one benefit in a grid of three, an icon, a heading, a line or two and an optional link, plain, tinted or inverse. Import it from @nizivo/react/unstable/feature-card.
Examples
Basic
The three styles side by side: plain, tinted and inverse.
Accessible by default
Accessible by default
Accessible by default
import type { JSX } from 'react';
import { Link } from '@nizivo/react/unstable/link';
import { FeatureCard } from '@nizivo/react/unstable/feature-card';
/** Stand-in for `@nizivo/icons` Sparkles (a Lucide stroke). */
function Sparkles(): JSX.Element {
return (
<svg
viewBox="0 0 24 24"
width="1em"
height="1em"
fill="none"
stroke="currentColor"
strokeWidth={1.92}
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z" />
<path d="M20 2v4" />
<path d="M22 4h-4" />
<circle cx="4" cy="20" r="2" />
</svg>
);
}
export function FeatureCardExample(): JSX.Element {
return (
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 24 }}>
{(['plain', 'tinted', 'inverse'] as const).map((variant) => (
<FeatureCard
key={variant}
variant={variant}
icon={<Sparkles />}
title="Accessible by default"
action={<Link href="/docs/accessibility/">Learn about accessibility</Link>}
>
Every colour pair passes WCAG 2.2 AA in Light and Dark, and focus is designed for every
control.
</FeatureCard>
))}
</div>
);
}
Import
import { FeatureCard } from '@nizivo/react/unstable/feature-card';
// Once per app (Getting started), after
// @nizivo/tokens/tokens.css and @nizivo/react/css/base.css
import '@nizivo/react/css/feature-card.css';Static or interactive
Server. No client JavaScript. How to choose.
Use
title is the card's heading (h3 by default), the children say the benefit and icon fills the
decorative tile. action takes a Link whose words make sense on their
own ("Learn about accessibility", not "Learn more"). variant is plain on surfaces, tinted to
group and inverse for emphasis.
Props
Server component Renders data-slot="feature-card" with the class nz-feature-card. Props: FeatureCardProps. Source: src/unstable/feature-card/feature-card.tsx.
| Name | Type | Default | Description |
|---|---|---|---|
action | ReactNode | – | After the text: a link, such as a Link. |
headingLevel | 2 | 3 | 4 | 3 | The title's level. |
icon | ReactNode | – | A 20 px glyph for the tile; decorative. |
render | RenderProp<Record<string, never>> | – | Must render an |
titlerequired | ReactNode | – | |
variant | "plain" | "tinted" | "inverse" | 'plain' | The card's surface: plain, tinted or inverse. |
- Also takes every attribute of
<article>excepttitle. (Omit<ComponentPropsWithRef<"article">, "title">)
render takes an element, or, in client code, a function of the props and no state.
Other exports
FeatureCardPropstypeimport type { FeatureCardProps } from '@nizivo/react/unstable/feature-card'The props of
FeatureCard, 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 |
|---|---|---|
feature-card.nz-feature-card | FeatureCardroot (takes render) |
|
feature-card-body.nz-feature-card-body | FeatureCardinner element (CSS only) | none |
feature-card-title.nz-feature-card-title | FeatureCardinner 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-feature-card, .nz-feature-card-action, .nz-feature-card-body, .nz-feature-card-icon, .nz-feature-card-title.
Tokens this stylesheet reads (22)
--nz-bg-brand-subtle, --nz-bg-inverse, --nz-bg-inverse-elevated, --nz-bg-surface, --nz-border-subtle, --nz-border-width-default, --nz-font-body-m, --nz-font-heading-h3, --nz-icon-brand, --nz-radius-md, --nz-radius-xl, --nz-size-icon-md, --nz-space-1, --nz-space-10, --nz-space-4, --nz-space-6, --nz-text-brand, --nz-text-inverse, --nz-text-inverse-accent, --nz-text-primary, --nz-text-secondary, --nz-tracking-heading-h3
Accessibility
Nothing in this component takes focus or keyboard input.
Keyboard
None.
EventCard
Unstable: a launch, a live session or a booking, a date block, the title, when and where, and who is going. Import it from @nizivo/react/unstable/event-card.
FeedbackBar
Unstable: "Was this helpful?" under an AI answer, a thumbs up and a thumbs down that toggle, and optional reasons after a thumbs down. Import it from @nizivo/react/unstable/feedback-bar.