1 GitHub star = 1 new component.

Star the repo
Layoutlayoutgridcards

Glass Card Grid

Responsive grid of frosted glass cards with border highlights.

Live Preview

Glass Card Grid

Usage

Copy and paste this code into your React component:

tsx
import { GlassCardGrid } from 'react-component-kit-ui/layout';

<GlassCardGrid>Content</GlassCardGrid>

Manual Installation

If you are not using the npm package, create a new file and paste the following code: src/components/GlassCardGrid.tsx + GlassCardGrid.css:

GlassCardGrid.tsx
'use client';

import type { CSSProperties, ReactNode } from 'react';
import './GlassCardGrid.css';

/** "a: b; --c: d" โ†’ style object */
function st(css: string | undefined): CSSProperties {
  const o: Record<string, string> = {};
  for (const decl of String(css ?? '').split(';')) {
    const i = decl.indexOf(':');
    if (i < 0) continue;
    const k = decl.slice(0, i).trim();
    if (k) o[k.startsWith('--') ? k : k.replace(/-([a-z])/g, (_, c) => c.toUpperCase())] = decl.slice(i + 1).trim();
  }
  return o as CSSProperties;
}

/**
 * GlassCardGrid โ€” A responsive grid specifically designed for card layouts with auto-fill columns.
 * 
 * @param {string} minWidth - Minimum width of columns (default: '300px').
 * @param {string} gap - Gap between items (default: '2rem').
 */
export interface GlassCardGridProps {
  minWidth?: string;
  gap?: string;
  className?: string;
  children?: ReactNode;
}

export function GlassCardGrid({ minWidth = '300px', gap = '2rem', className = '',
  children
}: GlassCardGridProps) {
  return (
    <>
      <div className={`card-grid ${className}`} style={st(`--min-width: ${minWidth}; --gap: ${gap};`)} data-rk-bc83a7="">
        {children}
      </div>
    </>
  );
}

export default GlassCardGrid;
GlassCardGrid.css
/* GlassCardGrid โ€” ported from astro-component-kit (layout/GlassCardGrid.astro) */

.card-grid:where([data-rk-bc83a7]) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--min-width, 300px), 1fr));
  gap: var(--gap, 2rem);
  width: 100%;
}

Quick Info

Category
Layout
Filename
GlassCardGrid.tsx
Dependencies
None โ€” pure React + CSS
Tags
layoutgridcards