Description List

Account details

Personal information and preferences.

Edit account details
Full name
Ava Martinez
Email
ava@example.com Verified
Plan
Team · billed yearly
Design style
Editorial
About
Product designer focused on design systems and accessible color. Based in Madrid.
@use 'sprucecss/scss/spruce' as *;

.description-list {
  background-color: color('surface');
  border: config('border-width-base', $display) solid color('border');
  border-radius: radius('lg');
  container-type: inline-size;
  overflow: hidden;

  &__header {
    align-items: flex-start;
    border-block-end: config('border-width-base', $display) solid color('border');
    display: flex;
    gap: spacer('s');
    justify-content: space-between;
    padding: spacer('m');
  }

  &__heading {
    @include layout-stack('xxs');
  }

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

  &__text {
    color: color('muted');
    font-size: config('font-size-sm', $typography);
  }

  &__list {
    margin: 0;
  }

  &__row {
    display: grid;
    gap: spacer('xxs') spacer('m');
    padding: spacer('s') spacer('m');

    & + & {
      border-block-start: config('border-width-base', $display) solid color('border');
    }

    @include container-query(32rem) {
      grid-template-columns: 12rem 1fr;
    }

    dt {
      color: color('muted');
      font-size: config('font-size-sm', $typography);
      font-weight: 600;
    }

    dd {
      align-items: center;
      color: color('heading');
      display: flex;
      flex-wrap: wrap;
      gap: spacer('xs');
      margin: 0;
    }
  }
}
<section class="description-list" aria-labelledby="description-list-title">
    <header class="description-list__header">
        <div class="description-list__heading">
            <h2 class="description-list__title" id="description-list-title">Account details</h2>
            <p class="description-list__text">Personal information and preferences.</p>
        </div>
        <a class="btn btn--outline-primary btn--sm" href="#">Edit<span class="sr-only"> account details</span></a>
    </header>
    <dl class="description-list__list">
        <div class="description-list__row">
            <dt>Full name</dt>
            <dd>Ava Martinez</dd>
        </div>
        <div class="description-list__row">
            <dt>Email</dt>
            <dd>ava@example.com <span class="badge badge--success">Verified</span></dd>
        </div>
        <div class="description-list__row">
            <dt>Plan</dt>
            <dd>Team · billed yearly</dd>
        </div>
        <div class="description-list__row">
            <dt>Design style</dt>
            <dd>Editorial</dd>
        </div>
        <div class="description-list__row">
            <dt>About</dt>
            <dd>Product designer focused on design systems and accessible color. Based in Madrid.</dd>
        </div>
    </dl>
</section>

Description List

On this page

A key–value list for profiles, settings summaries or order details.

Technical Details

  • A real description list (dl) with dt/dd pairs grouped in divs (allowed by the HTML standard), so screen readers announce the terms and values together.
  • It uses the new container-query() mixin: the label and value sit side by side when the component (not the viewport) is wider than 32rem, so it adapts in any column.
  • The edit link has a hidden text with the section name.
  • It combines the Badge component.

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.