Empty State

No projects yet

Projects keep your pages, components and styles together. Create your first one to get started.

@use 'sprucecss/scss/spruce' as *;

.empty-state {
  border: config('border-width-base', $display) dashed color('border-strong');
  border-radius: radius('lg');
  padding: spacer-clamp('l', 'xl') spacer('m');
  text-align: center;
  @include layout-stack('s');

  &__icon {
    align-items: center;
    background-color: color-alpha('primary', 0.1);
    block-size: 4rem;
    border-radius: 50%;
    color: color('primary');
    display: flex;
    inline-size: 4rem;
    justify-content: center;
    margin-inline: auto;

    svg {
      block-size: 2rem;
      inline-size: 2rem;
    }
  }

  &__title {
    font-size: font-size('h4');
  }

  &__text {
    color: color('muted');
    margin-inline: auto;
    max-inline-size: 30rem;
  }

  &__actions {
    @include layout-cluster('s', center);
    margin-block-start: spacer('xs');
  }
}
<section class="empty-state" aria-labelledby="empty-state-title">
    <div class="empty-state__icon" aria-hidden="true">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" focusable="false"><path d="M22 12h-6l-2 3h-4l-2-3H2"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/></svg>
    </div>
    <h2 class="empty-state__title" id="empty-state-title">No projects yet</h2>
    <p class="empty-state__text">Projects keep your pages, components and styles together. Create your first one to get started.</p>
    <div class="empty-state__actions">
        <a class="btn btn--primary" href="#">Create project</a>
        <a class="btn btn--ghost-primary" href="#">Import from GitHub</a>
    </div>
</section>

Empty State

On this page

What to show when there is no data yet: explain why the area is empty and offer the next step.

Technical Details

  • The section is labelled by its heading; adjust the heading level to the page outline.
  • The icon is decorative. Always explain the situation in words and give a clear primary action.
  • The dashed border-strong frame signals a "drop zone"-like area; remove the border to use it inside a card.

Documentation

Learn about Spruce CSS through our extensive documentation.

Components

Explore our UI library of accessible components built with Spruce CSS.

Blocks and Pages

Full-width page blocks and complete page templates, ready to copy.

Find us on GitHub

Did you find a bug? Have an idea or a question? Please open an issue to help us develop the project.