Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Expandable Card

    Compact card that grows into a centered detail view built on a native dialog, then shrinks back into place on close.

    Desk lamp

    Warm dimmable light with a weighted brass base.

    $48

    • Three brightness levels
    • USB-C powered
    • Ships in 2 days

    Linen notebook

    Lay-flat binding and 160 pages of dotted paper.

    $18

    • A5, 160 pages
    • Recycled cover
    • Ships tomorrow

    Ceramic mug

    Hand-glazed stoneware that keeps coffee warm longer.

    $14

    • 350 ml
    • Dishwasher safe
    • Ships in 3 days

    Wool throw

    Soft merino blanket woven in a classic herringbone.

    $64

    • 130 x 170 cm
    • Machine washable
    • Ships in 5 days

    Desk lamp

    Warm dimmable light with a weighted brass base.

    $48

    • Three brightness levels
    • USB-C powered
    • Ships in 2 days

    Linen notebook

    Lay-flat binding and 160 pages of dotted paper.

    $18

    • A5, 160 pages
    • Recycled cover
    • Ships tomorrow

    Ceramic mug

    Hand-glazed stoneware that keeps coffee warm longer.

    $14

    • 350 ml
    • Dishwasher safe
    • Ships in 3 days

    Wool throw

    Soft merino blanket woven in a classic herringbone.

    $64

    • 130 x 170 cm
    • Machine washable
    • Ships in 5 days

    Desk lamp

    Warm dimmable light with a weighted brass base.

    $48

    • Three brightness levels
    • USB-C powered
    • Ships in 2 days

    Linen notebook

    Lay-flat binding and 160 pages of dotted paper.

    $18

    • A5, 160 pages
    • Recycled cover
    • Ships tomorrow

    Ceramic mug

    Hand-glazed stoneware that keeps coffee warm longer.

    $14

    • 350 ml
    • Dishwasher safe
    • Ships in 3 days

    Wool throw

    Soft merino blanket woven in a classic herringbone.

    $64

    • 130 x 170 cm
    • Machine washable
    • Ships in 5 days

    Desk lamp

    Warm dimmable light with a weighted brass base.

    $48

    • Three brightness levels
    • USB-C powered
    • Ships in 2 days

    Linen notebook

    Lay-flat binding and 160 pages of dotted paper.

    $18

    • A5, 160 pages
    • Recycled cover
    • Ships tomorrow

    Ceramic mug

    Hand-glazed stoneware that keeps coffee warm longer.

    $14

    • 350 ml
    • Dishwasher safe
    • Ships in 3 days

    Wool throw

    Soft merino blanket woven in a classic herringbone.

    $64

    • 130 x 170 cm
    • Machine washable
    • Ships in 5 days

    Desk lamp

    Warm dimmable light with a weighted brass base.

    $48

    • Three brightness levels
    • USB-C powered
    • Ships in 2 days

    Linen notebook

    Lay-flat binding and 160 pages of dotted paper.

    $18

    • A5, 160 pages
    • Recycled cover
    • Ships tomorrow

    Ceramic mug

    Hand-glazed stoneware that keeps coffee warm longer.

    $14

    • 350 ml
    • Dishwasher safe
    • Ships in 3 days

    Wool throw

    Soft merino blanket woven in a classic herringbone.

    $64

    • 130 x 170 cm
    • Machine washable
    • Ships in 5 days
    @php
        $grid = 'grid grid-cols-2 gap-3';
        $art = 'flex h-full items-center justify-center text-ink';
        $specs = 'grid gap-1 text-muted';
        $price = 'text-base font-semibold text-ink';
    
        $products = [
            ['name' => 'Desk lamp', 'price' => '$48', 'summary' => 'Warm dimmable light with a weighted brass base.', 'specs' => ['Three brightness levels', 'USB-C powered', 'Ships in 2 days'], 'tone' => 'bg-primary-soft', 'icon' => 'M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11.2V16h6v-1.8A6 6 0 0 0 12 3Z'],
            ['name' => 'Linen notebook', 'price' => '$18', 'summary' => 'Lay-flat binding and 160 pages of dotted paper.', 'specs' => ['A5, 160 pages', 'Recycled cover', 'Ships tomorrow'], 'tone' => 'bg-success/15', 'icon' => 'M6 4h11a1 1 0 0 1 1 1v15H7a1 1 0 0 1-1-1V4Zm0 13h12M10 8h5'],
            ['name' => 'Ceramic mug', 'price' => '$14', 'summary' => 'Hand-glazed stoneware that keeps coffee warm longer.', 'specs' => ['350 ml', 'Dishwasher safe', 'Ships in 3 days'], 'tone' => 'bg-warning/15', 'icon' => 'M5 8h11v7a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4V8Zm11 2h1.5a2.5 2.5 0 0 1 0 5H16'],
            ['name' => 'Wool throw', 'price' => '$64', 'summary' => 'Soft merino blanket woven in a classic herringbone.', 'specs' => ['130 x 170 cm', 'Machine washable', 'Ships in 5 days'], 'tone' => 'bg-subtle', 'icon' => 'M4 6h16v12H4zM4 10h16M4 14h16'],
        ];
    @endphp
    
    <div class="{{ $grid }}">
        @foreach ($products as $product)
            <x-markas.expandable-card :title="$product['name']" :description="$product['summary']">
                <x-slot:media>
                    <span class="{{ $art }} {{ $product['tone'] }}">
                        <svg class="size-8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="{{ $product['icon'] }}" /></svg>
                    </span>
                </x-slot:media>
                <p class="{{ $price }}">{{ $product['price'] }}</p>
                <ul class="{{ $specs }}">
                    @foreach ($product['specs'] as $spec)
                        <li>{{ $spec }}</li>
                    @endforeach
                </ul>
                <x-slot:footer>
                    <x-markas.button>Add to cart</x-markas.button>
                </x-slot:footer>
            </x-markas.expandable-card>
        @endforeach
    </div>
    import { Button } from "@/components/markas/Button";
    import { ExpandableCard } from "@/components/markas/ExpandableCard";
    
    const grid = "grid grid-cols-2 gap-3";
    const art = "flex h-full items-center justify-center text-ink";
    const specs = "grid gap-1 text-muted";
    const price = "text-base font-semibold text-ink";
    
    const products = [
      {
        name: "Desk lamp",
        price: "$48",
        summary: "Warm dimmable light with a weighted brass base.",
        specs: ["Three brightness levels", "USB-C powered", "Ships in 2 days"],
        tone: "bg-primary-soft",
        icon: "M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11.2V16h6v-1.8A6 6 0 0 0 12 3Z",
      },
      {
        name: "Linen notebook",
        price: "$18",
        summary: "Lay-flat binding and 160 pages of dotted paper.",
        specs: ["A5, 160 pages", "Recycled cover", "Ships tomorrow"],
        tone: "bg-success/15",
        icon: "M6 4h11a1 1 0 0 1 1 1v15H7a1 1 0 0 1-1-1V4Zm0 13h12M10 8h5",
      },
      {
        name: "Ceramic mug",
        price: "$14",
        summary: "Hand-glazed stoneware that keeps coffee warm longer.",
        specs: ["350 ml", "Dishwasher safe", "Ships in 3 days"],
        tone: "bg-warning/15",
        icon: "M5 8h11v7a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4V8Zm11 2h1.5a2.5 2.5 0 0 1 0 5H16",
      },
      {
        name: "Wool throw",
        price: "$64",
        summary: "Soft merino blanket woven in a classic herringbone.",
        specs: ["130 x 170 cm", "Machine washable", "Ships in 5 days"],
        tone: "bg-subtle",
        icon: "M4 6h16v12H4zM4 10h16M4 14h16",
      },
    ];
    
    export default function ExpandableCardExample() {
      return (
        <div className={grid}>
          {products.map((product) => (
            <ExpandableCard
              key={product.name}
              title={product.name}
              description={product.summary}
              media={
                <span className={`${art} ${product.tone}`}>
                  <svg
                    className="size-8"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke="currentColor"
                    strokeWidth="1.5"
                    strokeLinecap="round"
                    strokeLinejoin="round"
                    aria-hidden="true"
                  >
                    <path d={product.icon} />
                  </svg>
                </span>
              }
              footer={<Button>Add to cart</Button>}
            >
              <p className={price}>{product.price}</p>
              <ul className={specs}>
                {product.specs.map((spec) => (
                  <li key={spec}>{spec}</li>
                ))}
              </ul>
            </ExpandableCard>
          ))}
        </div>
      );
    }
    <script setup lang="ts">
    import Button from "@/components/markas/Button.vue";
    import ExpandableCard from "@/components/markas/ExpandableCard.vue";
    
    const grid = "grid grid-cols-2 gap-3";
    const art = "flex h-full items-center justify-center text-ink";
    const specs = "grid gap-1 text-muted";
    const price = "text-base font-semibold text-ink";
    
    const products = [
      {
        name: "Desk lamp",
        price: "$48",
        summary: "Warm dimmable light with a weighted brass base.",
        specs: ["Three brightness levels", "USB-C powered", "Ships in 2 days"],
        tone: "bg-primary-soft",
        icon: "M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11.2V16h6v-1.8A6 6 0 0 0 12 3Z",
      },
      {
        name: "Linen notebook",
        price: "$18",
        summary: "Lay-flat binding and 160 pages of dotted paper.",
        specs: ["A5, 160 pages", "Recycled cover", "Ships tomorrow"],
        tone: "bg-success/15",
        icon: "M6 4h11a1 1 0 0 1 1 1v15H7a1 1 0 0 1-1-1V4Zm0 13h12M10 8h5",
      },
      {
        name: "Ceramic mug",
        price: "$14",
        summary: "Hand-glazed stoneware that keeps coffee warm longer.",
        specs: ["350 ml", "Dishwasher safe", "Ships in 3 days"],
        tone: "bg-warning/15",
        icon: "M5 8h11v7a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4V8Zm11 2h1.5a2.5 2.5 0 0 1 0 5H16",
      },
      {
        name: "Wool throw",
        price: "$64",
        summary: "Soft merino blanket woven in a classic herringbone.",
        specs: ["130 x 170 cm", "Machine washable", "Ships in 5 days"],
        tone: "bg-subtle",
        icon: "M4 6h16v12H4zM4 10h16M4 14h16",
      },
    ];
    </script>
    
    <template>
      <div :class="grid">
        <ExpandableCard
          v-for="product in products"
          :key="product.name"
          :title="product.name"
          :description="product.summary"
        >
          <template #media>
            <span :class="`${art} ${product.tone}`">
              <svg
                class="size-8"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                aria-hidden="true"
              >
                <path :d="product.icon" />
              </svg>
            </span>
          </template>
          <p :class="price">{{ product.price }}</p>
          <ul :class="specs">
            <li v-for="spec in product.specs" :key="spec">{{ spec }}</li>
          </ul>
          <template #footer>
            <Button>Add to cart</Button>
          </template>
        </ExpandableCard>
      </div>
    </template>
    <script lang="ts">
      import Button from "$lib/components/markas/Button.svelte";
      import ExpandableCard from "$lib/components/markas/ExpandableCard.svelte";
    
      const grid = "grid grid-cols-2 gap-3";
      const art = "flex h-full items-center justify-center text-ink";
      const specs = "grid gap-1 text-muted";
      const price = "text-base font-semibold text-ink";
    
      const products = [
        {
          name: "Desk lamp",
          price: "$48",
          summary: "Warm dimmable light with a weighted brass base.",
          specs: ["Three brightness levels", "USB-C powered", "Ships in 2 days"],
          tone: "bg-primary-soft",
          icon: "M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11.2V16h6v-1.8A6 6 0 0 0 12 3Z",
        },
        {
          name: "Linen notebook",
          price: "$18",
          summary: "Lay-flat binding and 160 pages of dotted paper.",
          specs: ["A5, 160 pages", "Recycled cover", "Ships tomorrow"],
          tone: "bg-success/15",
          icon: "M6 4h11a1 1 0 0 1 1 1v15H7a1 1 0 0 1-1-1V4Zm0 13h12M10 8h5",
        },
        {
          name: "Ceramic mug",
          price: "$14",
          summary: "Hand-glazed stoneware that keeps coffee warm longer.",
          specs: ["350 ml", "Dishwasher safe", "Ships in 3 days"],
          tone: "bg-warning/15",
          icon: "M5 8h11v7a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4V8Zm11 2h1.5a2.5 2.5 0 0 1 0 5H16",
        },
        {
          name: "Wool throw",
          price: "$64",
          summary: "Soft merino blanket woven in a classic herringbone.",
          specs: ["130 x 170 cm", "Machine washable", "Ships in 5 days"],
          tone: "bg-subtle",
          icon: "M4 6h16v12H4zM4 10h16M4 14h16",
        },
      ];
    </script>
    
    <div class={grid}>
      {#each products as product (product.name)}
        <ExpandableCard title={product.name} description={product.summary}>
          {#snippet media()}
            <span class={`${art} ${product.tone}`}>
              <svg
                class="size-8"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                aria-hidden="true"
              >
                <path d={product.icon} />
              </svg>
            </span>
          {/snippet}
          {#snippet footer()}
            <Button>Add to cart</Button>
          {/snippet}
          <p class={price}>{product.price}</p>
          <ul class={specs}>
            {#each product.specs as spec (spec)}
              <li>{spec}</li>
            {/each}
          </ul>
        </ExpandableCard>
      {/each}
    </div>
    ---
    import Button from "@/components/markas/Button.astro";
    import ExpandableCard from "@/components/markas/ExpandableCard.astro";
    
    const grid = "grid grid-cols-2 gap-3";
    const art = "flex h-full items-center justify-center text-ink";
    const specs = "grid gap-1 text-muted";
    const price = "text-base font-semibold text-ink";
    
    const products = [
      {
        name: "Desk lamp",
        price: "$48",
        summary: "Warm dimmable light with a weighted brass base.",
        specs: ["Three brightness levels", "USB-C powered", "Ships in 2 days"],
        tone: "bg-primary-soft",
        icon: "M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11.2V16h6v-1.8A6 6 0 0 0 12 3Z",
      },
      {
        name: "Linen notebook",
        price: "$18",
        summary: "Lay-flat binding and 160 pages of dotted paper.",
        specs: ["A5, 160 pages", "Recycled cover", "Ships tomorrow"],
        tone: "bg-success/15",
        icon: "M6 4h11a1 1 0 0 1 1 1v15H7a1 1 0 0 1-1-1V4Zm0 13h12M10 8h5",
      },
      {
        name: "Ceramic mug",
        price: "$14",
        summary: "Hand-glazed stoneware that keeps coffee warm longer.",
        specs: ["350 ml", "Dishwasher safe", "Ships in 3 days"],
        tone: "bg-warning/15",
        icon: "M5 8h11v7a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4V8Zm11 2h1.5a2.5 2.5 0 0 1 0 5H16",
      },
      {
        name: "Wool throw",
        price: "$64",
        summary: "Soft merino blanket woven in a classic herringbone.",
        specs: ["130 x 170 cm", "Machine washable", "Ships in 5 days"],
        tone: "bg-subtle",
        icon: "M4 6h16v12H4zM4 10h16M4 14h16",
      },
    ];
    ---
    
    <div class={grid}>
      {
        products.map((product) => (
          <ExpandableCard title={product.name} description={product.summary}>
            <span slot="media" class={`${art} ${product.tone}`}>
              <svg
                class="size-8"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                aria-hidden="true"
              >
                <path d={product.icon} />
              </svg>
            </span>
            <Button slot="footer">Add to cart</Button>
            <p class={price}>{product.price}</p>
            <ul class={specs}>
              {product.specs.map((spec) => (
                <li>{spec}</li>
              ))}
            </ul>
          </ExpandableCard>
        ))
      }
    </div>
    import { Component } from "@angular/core";
    import { Button } from "./markas/button.component";
    import {
      ExpandableCard,
      ExpandableCardMedia,
    } from "./markas/expandable-card.component";
    
    @Component({
      selector: "markas-example",
      imports: [Button, ExpandableCard, ExpandableCardMedia],
      template: `
        <div [class]="grid">
          @for (product of products; track product.name) {
            <markas-expandable-card
              [title]="product.name"
              [description]="product.summary"
            >
              <ng-template markasCardMedia>
                <span [class]="art + ' ' + product.tone">
                  <svg
                    class="size-8"
                    viewBox="0 0 24 24"
                    fill="none"
                    stroke="currentColor"
                    stroke-width="1.5"
                    stroke-linecap="round"
                    stroke-linejoin="round"
                    aria-hidden="true"
                  >
                    <path [attr.d]="product.icon" />
                  </svg>
                </span>
              </ng-template>
              <button markas-button footer>Add to cart</button>
              <p [class]="price">{{ product.price }}</p>
              <ul [class]="specs">
                @for (spec of product.specs; track spec) {
                  <li>{{ spec }}</li>
                }
              </ul>
            </markas-expandable-card>
          }
        </div>
      `,
    })
    export default class ExpandableCardExample {
      protected readonly grid = "grid grid-cols-2 gap-3";
      protected readonly art = "flex h-full items-center justify-center text-ink";
      protected readonly specs = "grid gap-1 text-muted";
      protected readonly price = "text-base font-semibold text-ink";
      protected readonly products = [
        {
          name: "Desk lamp",
          price: "$48",
          summary: "Warm dimmable light with a weighted brass base.",
          specs: ["Three brightness levels", "USB-C powered", "Ships in 2 days"],
          tone: "bg-primary-soft",
          icon: "M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11.2V16h6v-1.8A6 6 0 0 0 12 3Z",
        },
        {
          name: "Linen notebook",
          price: "$18",
          summary: "Lay-flat binding and 160 pages of dotted paper.",
          specs: ["A5, 160 pages", "Recycled cover", "Ships tomorrow"],
          tone: "bg-success/15",
          icon: "M6 4h11a1 1 0 0 1 1 1v15H7a1 1 0 0 1-1-1V4Zm0 13h12M10 8h5",
        },
        {
          name: "Ceramic mug",
          price: "$14",
          summary: "Hand-glazed stoneware that keeps coffee warm longer.",
          specs: ["350 ml", "Dishwasher safe", "Ships in 3 days"],
          tone: "bg-warning/15",
          icon: "M5 8h11v7a4 4 0 0 1-4 4H9a4 4 0 0 1-4-4V8Zm11 2h1.5a2.5 2.5 0 0 1 0 5H16",
        },
        {
          name: "Wool throw",
          price: "$64",
          summary: "Soft merino blanket woven in a classic herringbone.",
          specs: ["130 x 170 cm", "Machine washable", "Ships in 5 days"],
          tone: "bg-subtle",
          icon: "M4 6h16v12H4zM4 10h16M4 14h16",
        },
      ];
    }

    Examples

    Article list without media

    Designing calm notifications

    Why fewer, smarter alerts keep people focused, and how we cut ours by half without losing anything important.

    We grouped alerts by urgency, moved low-priority updates into a daily digest, and let people snooze whole projects.

    6 min read · Product

    A field guide to empty states

    Empty screens are the first thing new users see. Here are five patterns that turn them into a helpful start.

    Show a preview of what the screen will look like, offer one clear action, and never blame the user for having no data yet.

    4 min read · Design

    Shipping faster with smaller pull requests

    Our median review time dropped from two days to four hours after we capped pull requests at 300 lines.

    Small changes are easier to review, easier to revert, and keep the main branch moving every day.

    8 min read · Engineering

    Designing calm notifications

    Why fewer, smarter alerts keep people focused, and how we cut ours by half without losing anything important.

    We grouped alerts by urgency, moved low-priority updates into a daily digest, and let people snooze whole projects.

    6 min read · Product

    A field guide to empty states

    Empty screens are the first thing new users see. Here are five patterns that turn them into a helpful start.

    Show a preview of what the screen will look like, offer one clear action, and never blame the user for having no data yet.

    4 min read · Design

    Shipping faster with smaller pull requests

    Our median review time dropped from two days to four hours after we capped pull requests at 300 lines.

    Small changes are easier to review, easier to revert, and keep the main branch moving every day.

    8 min read · Engineering

    Designing calm notifications

    Why fewer, smarter alerts keep people focused, and how we cut ours by half without losing anything important.

    We grouped alerts by urgency, moved low-priority updates into a daily digest, and let people snooze whole projects.

    6 min read · Product

    A field guide to empty states

    Empty screens are the first thing new users see. Here are five patterns that turn them into a helpful start.

    Show a preview of what the screen will look like, offer one clear action, and never blame the user for having no data yet.

    4 min read · Design

    Shipping faster with smaller pull requests

    Our median review time dropped from two days to four hours after we capped pull requests at 300 lines.

    Small changes are easier to review, easier to revert, and keep the main branch moving every day.

    8 min read · Engineering

    Designing calm notifications

    Why fewer, smarter alerts keep people focused, and how we cut ours by half without losing anything important.

    We grouped alerts by urgency, moved low-priority updates into a daily digest, and let people snooze whole projects.

    6 min read · Product

    A field guide to empty states

    Empty screens are the first thing new users see. Here are five patterns that turn them into a helpful start.

    Show a preview of what the screen will look like, offer one clear action, and never blame the user for having no data yet.

    4 min read · Design

    Shipping faster with smaller pull requests

    Our median review time dropped from two days to four hours after we capped pull requests at 300 lines.

    Small changes are easier to review, easier to revert, and keep the main branch moving every day.

    8 min read · Engineering

    Designing calm notifications

    Why fewer, smarter alerts keep people focused, and how we cut ours by half without losing anything important.

    We grouped alerts by urgency, moved low-priority updates into a daily digest, and let people snooze whole projects.

    6 min read · Product

    A field guide to empty states

    Empty screens are the first thing new users see. Here are five patterns that turn them into a helpful start.

    Show a preview of what the screen will look like, offer one clear action, and never blame the user for having no data yet.

    4 min read · Design

    Shipping faster with smaller pull requests

    Our median review time dropped from two days to four hours after we capped pull requests at 300 lines.

    Small changes are easier to review, easier to revert, and keep the main branch moving every day.

    8 min read · Engineering

    Team directory

    Nadia Rahma

    Engineering lead

    Leads the platform team and loves a well-written postmortem.

    nadia@example.com

    Owen Park

    Product designer

    Sketches every flow on paper before opening a design tool.

    owen@example.com

    Putu Arya

    Customer success

    Turns tricky support tickets into product improvements.

    putu@example.com

    Nadia Rahma

    Engineering lead

    Leads the platform team and loves a well-written postmortem.

    nadia@example.com

    Owen Park

    Product designer

    Sketches every flow on paper before opening a design tool.

    owen@example.com

    Putu Arya

    Customer success

    Turns tricky support tickets into product improvements.

    putu@example.com

    Nadia Rahma

    Engineering lead

    Leads the platform team and loves a well-written postmortem.

    nadia@example.com

    Owen Park

    Product designer

    Sketches every flow on paper before opening a design tool.

    owen@example.com

    Putu Arya

    Customer success

    Turns tricky support tickets into product improvements.

    putu@example.com

    Nadia Rahma

    Engineering lead

    Leads the platform team and loves a well-written postmortem.

    nadia@example.com

    Owen Park

    Product designer

    Sketches every flow on paper before opening a design tool.

    owen@example.com

    Putu Arya

    Customer success

    Turns tricky support tickets into product improvements.

    putu@example.com

    Nadia Rahma

    Engineering lead

    Leads the platform team and loves a well-written postmortem.

    nadia@example.com

    Owen Park

    Product designer

    Sketches every flow on paper before opening a design tool.

    owen@example.com

    Putu Arya

    Customer success

    Turns tricky support tickets into product improvements.

    putu@example.com

    Project overview

    Mobile app redesign

    New navigation and onboarding for iOS and Android.

    On track

    42 of 58tasks done

    Dec 12due date

    Billing migration

    Move every workspace to the new invoicing provider.

    At risk

    17 of 40tasks done

    Nov 28due date

    Mobile app redesign

    New navigation and onboarding for iOS and Android.

    On track

    42 of 58tasks done

    Dec 12due date

    Billing migration

    Move every workspace to the new invoicing provider.

    At risk

    17 of 40tasks done

    Nov 28due date

    Mobile app redesign

    New navigation and onboarding for iOS and Android.

    On track

    42 of 58tasks done

    Dec 12due date

    Billing migration

    Move every workspace to the new invoicing provider.

    At risk

    17 of 40tasks done

    Nov 28due date

    Mobile app redesign

    New navigation and onboarding for iOS and Android.

    On track

    42 of 58tasks done

    Dec 12due date

    Billing migration

    Move every workspace to the new invoicing provider.

    At risk

    17 of 40tasks done

    Nov 28due date

    Mobile app redesign

    New navigation and onboarding for iOS and Android.

    On track

    42 of 58tasks done

    Dec 12due date

    Billing migration

    Move every workspace to the new invoicing provider.

    At risk

    17 of 40tasks done

    Nov 28due date

    Installation

    npx markasui@latest add expandable-card

    Usage

    <div class="grid grid-cols-2 gap-3">
        @foreach ($products as $product)
            <x-markas.expandable-card :title="$product->name" :description="$product->summary">
                <x-slot:media>
                    <img src="{{ $product->image }}" alt="" class="size-full object-cover" />
                </x-slot:media>
                <p class="text-base font-semibold">{{ $product->price }}</p>
                <x-slot:footer>
                    <x-markas.button>Add to cart</x-markas.button>
                </x-slot:footer>
            </x-markas.expandable-card>
        @endforeach
    </div>

    Needs Alpine.js.

    import { Button } from "@/components/markas/Button";
    import { ExpandableCard } from "@/components/markas/ExpandableCard";
    
    <div className="grid grid-cols-2 gap-3">
      {products.map((product) => (
        <ExpandableCard
          key={product.id}
          title={product.name}
          description={product.summary}
          media={
            <img src={product.image} alt="" className="size-full object-cover" />
          }
          footer={<Button>Add to cart</Button>}
        >
          <p className="text-base font-semibold">{product.price}</p>
        </ExpandableCard>
      ))}
    </div>;
    <template>
      <div class="grid grid-cols-2 gap-3">
        <ExpandableCard
          v-for="product in products"
          :key="product.id"
          :title="product.name"
          :description="product.summary"
        >
          <template #media>
            <img :src="product.image" alt="" class="size-full object-cover" />
          </template>
          <p class="text-base font-semibold">{{ product.price }}</p>
          <template #footer>
            <Button>Add to cart</Button>
          </template>
        </ExpandableCard>
      </div>
    </template>
    <script lang="ts">
      import Button from "$lib/components/markas/Button.svelte";
      import ExpandableCard from "$lib/components/markas/ExpandableCard.svelte";
    </script>
    
    <div class="grid grid-cols-2 gap-3">
      {#each products as product (product.id)}
        <ExpandableCard title={product.name} description={product.summary}>
          {#snippet media()}
            <img src={product.image} alt="" class="size-full object-cover" />
          {/snippet}
          {#snippet footer()}
            <Button>Add to cart</Button>
          {/snippet}
          <p class="text-base font-semibold">{product.price}</p>
        </ExpandableCard>
      {/each}
    </div>
    ---
    import Button from "@/components/markas/Button.astro";
    import ExpandableCard from "@/components/markas/ExpandableCard.astro";
    ---
    
    <div class="grid grid-cols-2 gap-3">
      {
        products.map((product) => (
          <ExpandableCard title={product.name} description={product.summary}>
            <img slot="media" src={product.image} alt="" class="size-full object-cover" />
            <Button slot="footer">Add to cart</Button>
            <p class="text-base font-semibold">{product.price}</p>
          </ExpandableCard>
        ))
      }
    </div>

    The media slot is rendered once and shown on both the card and the open view. A small custom element opens the dialog and plays the grow and shrink.

    import { Component } from "@angular/core";
    import { Button } from "./markas/button.component";
    import {
      ExpandableCard,
      ExpandableCardMedia,
    } from "./markas/expandable-card.component";
    
    @Component({
      selector: "app-products",
      imports: [Button, ExpandableCard, ExpandableCardMedia],
      template: `
        @for (product of products; track product.id) {
          <markas-expandable-card
            [title]="product.name"
            [description]="product.summary"
          >
            <ng-template markasCardMedia>
              <img [src]="product.image" alt="" class="size-full object-cover" />
            </ng-template>
            <button markas-button footer>Add to cart</button>
            <p class="text-base font-semibold">{{ product.price }}</p>
          </markas-expandable-card>
        }
      `,
    })
    export class Products {
      products = [
        {
          id: 1,
          name: "Desk lamp",
          summary: "Warm light.",
          image: "/lamp.jpg",
          price: "$48",
        },
      ];
    }

    Media sits in an ng-template markasCardMedia because it is shown twice. An element with the footer attribute fills the action row.

    • One component renders one card and its dialog. Arrange several in your own grid or list.
    • Opening measures the card, shows the native modal dialog, and animates it from the card’s box to the center (FLIP). Closing plays it backwards and the card reappears in place.
    • Escape, a backdrop click, and the close button all run the shrink animation. Focus returns to the card.
    • The media slot renders twice, once on the card and once in the dialog. Give images alt="" when the title already names them.
    • Attributes and class go to the card button.

    Props

    NameTypeDefaultDescription
    titlestring-Card title. Also the heading and accessible name of the open view.
    descriptionstring-Short summary. Clamped to two lines on the card, shown in full when open.
    mediaBlade: named slot · React: ReactNode · Vue: #media slot-Image or illustration. Rendered 112px tall on the card and 192px tall in the open view.
    childrenBlade: default slot · React: children · Vue: default slot-Extra detail shown only in the open view.
    footerBlade: named slot · React: ReactNode · Vue: #footer slot-Actions at the bottom of the open view, for example Add to cart.
    closeLabelstringCloseAccessible name of the close button.
    idstringautoId of the card button. The dialog uses the same id with a -dialog suffix.
    markasCardMediang-template-Angular only. Put the media in <ng-template markasCardMedia> (import ExpandableCardMedia), since it shows on the card and in the open view. An element with the footer attribute fills the actions.

    Accessibility

    • The card is a real button with aria-haspopup dialog, so Enter and Space open it.
    • The detail view is a native modal dialog labelled by its heading. Focus moves inside and the page behind is inert.
    • Escape, a backdrop click, or the close button closes it, and focus returns to the card.
    • With reduced motion the dialog opens and closes instantly without the grow and shrink animation.

    Related components

    More markasui components with the same classes in every framework.