Skip to documentation

Design system / Sources & standards

Current repository source

showcaseGrid.tsx

src/components/showcase/showcaseGrid.tsx

This view contains the escaped source read during the deployment build. Code and policy text are unchanged. Markdown is shown as source, not rendered as a document. A new deployment refreshes the content.

import { Children, isValidElement, type CSSProperties, type ReactNode } from "react";

/** Slot-only layout: no media, carousel, data or interaction ownership. */
export function ShowcaseGrid({ featured, companion, children }: { featured: ReactNode; companion: ReactNode; children?: ReactNode }) {
  const cards = Children.toArray(children);
  return <div className="showcase-layout">
    <div data-slot="showcase-grid" className="showcase-grid">
      <div data-slot="showcase-grid-featured" className="showcase-grid-featured">{featured}</div>
      <div data-slot="showcase-grid-companion" className="showcase-grid-companion" tabIndex={0}>{companion}</div>
      {cards.map((card, index) => {
        const rowCount = Math.min(3, cards.length - Math.floor(index / 3) * 3);
        return <div key={isValidElement(card) ? card.key : index} data-slot="showcase-grid-item" className="showcase-grid-item" style={{ "--showcase-span": 6 / rowCount } as CSSProperties}>{card}</div>;
      })}
    </div>
  </div>;
}
All sources and standards
Current components and theme tokens. Fictional example data. Source views refresh on deployment; authors maintain contract notes.