Playground

Empty state

Say that there is nothing here yet and offer the next step.

  • Built on native elements
  • Plain heading and text; put the action in children as a button or link.
  • Styles in one file: empty-state.css

Import

import '@monoline/css';
import {EmptyState} from '@monoline/react';

Not installed yet? Pick a route.

Copies the source and its styles into your project.

npx monoline add empty-state

Usage

import {Button, EmptyState} from '@monoline/react';

<EmptyState title="No projects yet" description="Projects you create show up here.">
  <Button variant="solid">New project</Button>
</EmptyState>

Examples

With an action

Props

EmptyStateProps

PropTypeDefaultDescription
title requiredReactNode–Short headline saying what is missing, for example "No projects yet".
descriptionReactNode–Optional sentence explaining why it is empty or what to do next.
iconReactNode–Optional inline SVG, `aria-hidden`.
childrenReactNode–The next step: a Button or link.

Data Attributes

State is exposed through attributes. Style it with these selectors, not with class toggles.

This component sets no state attributes.

CSS classes

ClassStylesheet
.emptyempty-state.css
.empty-actionsempty-state.css
.empty-descriptionempty-state.css
.empty-iconempty-state.css
.empty-titleempty-state.css

Customization

Style it with the kit's tokens in your own CSS, loaded after @monoline/css. Prefer the attributes above over extra classes. See Theming for every token.

app.css
.empty {
  border-color: var(--accent);
}

Accessibility

  • Plain heading and text; put the action in children as a button or link.