# Liquid glass card

> A plain Haze card surface (bordered, flat, no blur or glow) with an optional header, body slot and footer, shown as a compact music player.

- Kind: ui · Category: Layout and media · Interactivity: none
- Install: `npx shadcn@latest add @haze/liquid-glass-card`
- File: `src/components/haze/ui/liquid-glass-card.astro`
- npm dependencies: none
- Registry dependencies: @haze/utils
- Docs page: https://hazeui.com/ui/liquid-glass-card

## Use when
- A highlighted widget or feature card needs a flat bordered surface with an optional eyebrow, title, action and footer
- You want a reusable card slot container that matches the Haze neutral surfaces in dark and light themes

## Avoid when
- A plain content box with no header or footer structure is enough. Use card.
- The surface is a media frame. Use frame.

## Alternatives
- [card](https://hazeui.com/ui/card.md)
- [bento-tile](https://hazeui.com/ui/bento-tile.md)
- [frame](https://hazeui.com/ui/frame.md)

## Props

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| id | `string` |  | no | Optional id on the card element. |
| eyebrow | `string` |  | no | Optional uppercase label rendered above the title; defaults to a sample label when no default slot is provided. |
| title | `string` |  | no | Optional card heading text; defaults to a sample title when no default slot is provided. |
| description | `string` |  | no | Optional supporting summary text under the heading. |
| padding | `"none" \| "sm" \| "md" \| "lg"` | "md" | no | Internal spacing density for the card body and footer. |
| interactive | `boolean` | false | no | Strengthens the border on hover and focus when the card acts as an interactive surface. |
| headingLevel | `2 \| 3 \| 4` | 3 | no | Heading level for the optional card title. |
| class | `string` |  | no | Additional classes on the outer card element. |

## Accessibility
- Uses solid card tokens with no blur or translucency, so copy keeps full contrast on any backdrop.
- The demo scrubber is a native range input with an accessible label; play, previous and next are real buttons.

## Agent prompts

### Install and use

Install the Haze UI component "Liquid glass card" with `npx shadcn@latest add @haze/liquid-glass-card`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "https://hazeui.com/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import LiquidGlassCard from "@/components/haze/ui/liquid-glass-card.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: https://hazeui.com/ui/liquid-glass-card.md

### Customize with real content

Adapt the Haze liquid-glass-card ui for our product. Replace the demo values of these props with our real content: id, eyebrow, title, description, padding, interactive, headingLevel, class. Keep the layout, the heading level rules and these accessibility details: Uses solid card tokens with no blur or translucency, so copy keeps full contrast on any backdrop. The demo scrubber is a native range input with an accessible label; play, previous and next are real buttons. Do not add raw color classes; use the Haze tokens.

### Choose the right block

Before using liquid-glass-card, check it fits: use it when a highlighted widget or feature card needs a flat bordered surface with an optional eyebrow, title, action and footer; you want a reusable card slot container that matches the haze neutral surfaces in dark and light themes. Avoid it when a plain content box with no header or footer structure is enough. use card.; the surface is a media frame. use frame.. Alternatives: @haze/card, @haze/bento-tile, @haze/frame.

## Example requests that should lead here
- Wrap a compact vinyl audio player widget inside a plain bordered card.
- Create a flat card with an eyebrow, title, action slot and footer.

## Source

```astro
---
import { cn } from "../../../lib/haze/utils";

type CardPadding = "none" | "sm" | "md" | "lg";

interface Props {
  /** Optional id for the card element. */
  id?: string;
  eyebrow?: string;
  title?: string;
  description?: string;
  padding?: CardPadding;
  interactive?: boolean;
  headingLevel?: 2 | 3 | 4;
  class?: string;
}

const {
  id,
  eyebrow,
  title,
  description,
  padding = "md",
  interactive = false,
  headingLevel = 3,
  class: className,
} = Astro.props;

const Heading = ({ 2: "h2", 3: "h3", 4: "h4" } as const)[headingLevel];
const hasAction = Astro.slots.has("action");
const hasFooter = Astro.slots.has("footer");
const hasBody = Astro.slots.has("default");

const resolvedEyebrow = eyebrow ?? (hasBody ? undefined : "Workspace");
const resolvedTitle = title ?? (hasBody ? undefined : "Edge network");
const resolvedDescription =
  description ?? (hasBody ? undefined : "A plain card surface with an optional header, body and footer.");
const hasHeader = Boolean(resolvedEyebrow || resolvedTitle || resolvedDescription || hasAction);

const pad: Record<CardPadding, string> = {
  none: "",
  sm: "p-4 gap-3",
  md: "p-5 gap-4",
  lg: "p-6 gap-5",
};

const footerPad: Record<CardPadding, string> = {
  none: "px-5 py-3.5",
  sm: "px-4 py-3",
  md: "px-5 py-3.5",
  lg: "px-6 py-4",
};
---

<article
  id={id}
  class={cn(
    "flex min-w-0 flex-col overflow-hidden rounded-xl border border-border bg-card text-card-foreground",
    interactive &&
      "transition-colors duration-200 ease-snappy motion-reduce:transition-none hover:border-border-strong has-focus-visible:border-border-strong",
    className,
  )}
>
  <div class={cn("flex min-w-0 flex-1 flex-col", pad[padding])}>
    {
      hasHeader && (
        <div class="flex min-w-0 items-start justify-between gap-3">
          <div class="grid min-w-0 gap-1">
            {resolvedEyebrow && (
              <p class="text-xs/4 font-medium tracking-[0.02em] text-muted-foreground uppercase">{resolvedEyebrow}</p>
            )}
            {resolvedTitle && (
              <Heading class="text-[1.0625rem]/6 font-medium tracking-[-0.01em] text-card-foreground wrap-anywhere">
                {resolvedTitle}
              </Heading>
            )}
            {resolvedDescription && (
              <p class="text-[0.8125rem]/5 text-muted-foreground text-pretty wrap-anywhere">{resolvedDescription}</p>
            )}
          </div>
          {hasAction && (
            <div class="shrink-0">
              <slot name="action" />
            </div>
          )}
        </div>
      )
    }

    <div class="min-w-0 text-[0.8125rem]/5 text-card-foreground">
      {
        hasBody ? (
          <slot />
        ) : (
          <dl class="grid grid-cols-2 gap-3 rounded-lg bg-muted p-3">
            <div class="grid min-w-0 gap-0.5">
              <dt class="text-xs/4 text-muted-foreground">Latency</dt>
              <dd class="font-medium text-foreground tabular-nums">11.4 ms</dd>
            </div>
            <div class="grid min-w-0 gap-0.5">
              <dt class="text-xs/4 text-muted-foreground">Edge nodes</dt>
              <dd class="font-medium text-foreground tabular-nums">32 active</dd>
            </div>
          </dl>
        )
      }
    </div>
  </div>

  {
    hasFooter && (
      <div class={cn("border-t border-border text-[0.8125rem]/5 text-muted-foreground", footerPad[padding])}>
        <slot name="footer" />
      </div>
    )
  }
</article>
```
