# Feature grid (themes.dev UI block)

A section header and three to six features in open columns: a bare icon, a title, a line and an optional link. No cards, no icon tiles. Black and white, dark mode, shadcn-compatible; React, Astro and plain HTML.

81% of 289 about pages and 80% of 671 home pages we studied have a features section.

## Install

- React: `npx shadcn@latest add https://www.themes.dev/ui/r/feature-grid.json`
- Astro: `npx shadcn@latest add https://www.themes.dev/ui/r/astro/feature-grid.json`
- HTML: https://www.themes.dev/ui/r/html/feature-grid.html (with https://www.themes.dev/ui/r/html/caseroom.css)

Page: https://www.themes.dev/ui/blocks/feature-grid/ · Rules for agents: https://www.themes.dev/ui/AGENT.md

## Code

### feature-grid.astro

```astro
---
import Icon from '@/components/ui/icon.astro';
import Link from '@/components/ui/link.astro';
import SectionHeader from '@/components/ui/section-header.astro';
import { cn } from '@/lib/utils';
import { featureGrid as c, type FeatureGridContent } from './feature-grid.classes';

type Props = FeatureGridContent & { class?: string };
const { kicker, title, description, features, id, class: className } = Astro.props;
---

<section aria-labelledby={`${id}-title`} class={cn(c.root, className)}>
  <div class={c.inner}>
    <SectionHeader id={`${id}-title`} kicker={kicker} title={title} description={description} />
    <ul role="list" class={c.list(features.length)}>
      {
        features.map((f) => (
          <li class={c.item}>
            <Icon name={f.icon} class={c.icon} />
            <h3 class={c.title}>{f.title}</h3>
            <p class={c.text}>{f.text}</p>
            {f.link && <Link href={f.link.href} variant="standalone" class={c.link}>{f.link.label}</Link>}
          </li>
        ))
      }
    </ul>
  </div>
</section>
```

### feature-grid.classes.ts

```tsx
import type { IconName } from '@/components/ui/icon';

/** Feature grid: a section header, then three to six features in open columns (an icon, a title, one or two lines and
 *  an optional link). No cards and no icon tiles: the icon sits bare in the text colour. One column on a phone, two from
 *  36rem of the block's own width, three from 56rem (four when there are four or eight features). */
export const featureGrid = {
  root: '@container bg-background px-6 py-16 text-foreground @3xl:py-24',
  inner: 'mx-auto flex max-w-6xl flex-col gap-12',
  list: (count: number) =>
    ['m-0 grid list-none gap-x-10 gap-y-10 p-0 @xl:grid-cols-2', count % 4 === 0 ? '@4xl:grid-cols-4' : '@4xl:grid-cols-3'].join(' '),
  item: 'flex min-w-0 flex-col gap-2',
  icon: 'mb-2 size-5',
  title: 'text-base leading-snug font-semibold text-balance',
  text: 'text-base text-pretty text-muted-foreground',
  link: 'mt-1 self-start',
};

export type Feature = { icon: IconName; title: string; text: string; link?: { href: string; label: string } };
export type FeatureGridContent = {
  kicker?: string;
  title: string;
  description?: string;
  features: Feature[];
  /** Unique on the page; ids the heading. */
  id: string;
};
```

### feature-grid.tsx

```tsx
import { Icon } from '@/components/ui/icon';
import { Link } from '@/components/ui/link';
import { SectionHeader } from '@/components/ui/section-header';
import { cn } from '@/lib/utils';
import { featureGrid as c, type FeatureGridContent } from './feature-grid.classes';

export type FeatureGridProps = FeatureGridContent & { className?: string };

/** A section header and three to six features in open columns: icon, title, a line and an optional link. */
export function FeatureGrid({ kicker, title, description, features, id, className }: FeatureGridProps) {
  return (
    <section aria-labelledby={`${id}-title`} className={cn(c.root, className)}>
      <div className={c.inner}>
        <SectionHeader id={`${id}-title`} kicker={kicker} title={title} description={description} />
        <ul role="list" className={c.list(features.length)}>
          {features.map((f) => (
            <li key={f.title} className={c.item}>
              <Icon name={f.icon} className={c.icon} />
              <h3 className={c.title}>{f.title}</h3>
              <p className={c.text}>{f.text}</p>
              {f.link && <Link href={f.link.href} variant="standalone" className={c.link}>{f.link.label}</Link>}
            </li>
          ))}
        </ul>
      </div>
    </section>
  );
}
```
