Skip to content

Item ​

A row with media, a title, a description and actions, for settings lists, files or people.

Installation ​

bash
npx bootcn add item
bash
pnpm dlx bootcn add item
bash
yarn dlx bootcn add item
bash
bunx --bun bootcn add item

The CLI also installs the design tokens and these components: button, avatar. It prints the <link> and <script> tags to add to your layout.

Usage ​

Use .bootcn-item for one row: optional media (an icon in .bootcn-item__media--icon, or an avatar), the content, and actions. Variants: --outline (bordered) and --muted (filled). Make the whole row a link by using <a class="bootcn-item">, without nested buttons.

Accessibility ​

  • Rows in a <ul> are announced as a list with a count.
  • A linked row has one link with the title as its name; do not nest other interactive elements in it.

Dependencies ​

  • Bootstrap 5.3+ CSS.
  • themes/tokens/tokens.css.
  • The button component.
  • The avatar component.

Source ​

The exact files the CLI installs (item@1.0.0). View on GitHub · Report an issue

html
<ul class="bootcn-item-group">
  <li class="bootcn-item bootcn-item--outline">
    <span class="bootcn-item__media bootcn-item__media--icon"
      ><svg
        class="bootcn-icon"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        focusable="false"
      >
        <path d="M12 3 4 6v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V6z" /></svg
    ></span>
    <div class="bootcn-item__content">
      <p class="bootcn-item__title">Two-factor authentication</p>
      <p class="bootcn-item__description">Verify sign-ins with a code from your phone.</p>
    </div>
    <div class="bootcn-item__actions">
      <button type="button" class="btn bootcn-button bootcn-button--outline bootcn-button--sm">
        Enable
      </button>
    </div>
  </li>
  <li class="bootcn-item bootcn-item--outline">
    <span class="bootcn-item__media"
      ><span class="bootcn-avatar bootcn-avatar--sm" aria-hidden="true"
        ><span class="bootcn-avatar__fallback">EK</span></span
      ></span
    >
    <div class="bootcn-item__content">
      <p class="bootcn-item__title">Eleni Kosta</p>
      <p class="bootcn-item__description">eleni@example.com · Owner</p>
    </div>
    <div class="bootcn-item__actions">
      <button type="button" class="btn bootcn-button bootcn-button--ghost bootcn-button--sm">
        Manage
      </button>
    </div>
  </li>
  <li>
    <a class="bootcn-item bootcn-item--muted" href="#billing">
      <div class="bootcn-item__content">
        <p class="bootcn-item__title">Billing</p>
        <p class="bootcn-item__description">Invoices, payment methods and plan.</p>
      </div>
      <svg
        class="bootcn-icon bootcn-item__chevron"
        width="16"
        height="16"
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
        focusable="false"
      >
        <path d="m9 18 6-6-6-6" />
      </svg>
    </a>
  </li>
</ul>
css
.bootcn-item-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 32rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bootcn-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: var(--bootcn-border-width) solid transparent;
  border-radius: var(--bootcn-radius-lg);
  color: var(--bootcn-foreground);
  text-decoration: none;
}

.bootcn-item--outline {
  border-color: var(--bootcn-border-color);
}

.bootcn-item--muted {
  background-color: var(--bootcn-muted);
}

a.bootcn-item {
  transition: background-color var(--bootcn-transition);
}

a.bootcn-item:hover {
  background-color: var(--bootcn-accent);
}

a.bootcn-item:focus-visible {
  outline: 0;
  box-shadow: var(--bootcn-focus-ring);
}

.bootcn-item__media {
  display: flex;
  flex: none;
}

.bootcn-item__media--icon {
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: var(--bootcn-border-width) solid var(--bootcn-border-color);
  border-radius: var(--bootcn-radius);
  background-color: var(--bootcn-muted);
}

.bootcn-item__content {
  flex: 1 1 auto;
  min-width: 0;
}

.bootcn-item__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.bootcn-item__description {
  margin: 0.125rem 0 0;
  color: var(--bootcn-muted-foreground);
  font-size: 0.875rem;
}

.bootcn-item--muted .bootcn-item__description {
  color: var(--bootcn-muted-foreground);
}

.bootcn-item__actions {
  display: flex;
  flex: none;
  gap: 0.5rem;
}

.bootcn-item__chevron {
  flex: none;
  color: var(--bootcn-muted-foreground);
}

Released under the MIT License. Not affiliated with Bootstrap or shadcn/ui.