Lewati ke konten
MarkasUI
Ketik untuk mencari

    Panduan

    MarkasUI

    Form

    Feedback

    Overlay

    Navigasi

    Data

    Section

    Animasi

    Latar

    Tombol

    Template

    Halaman

    Expandable Card

    Kartu ringkas yang tumbuh menjadi tampilan detail di tengah layar berbasis dialog native, lalu menyusut kembali ke tempatnya saat ditutup.

    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",
        },
      ];
    }

    Contoh

    Daftar artikel tanpa 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

    Direktori tim

    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

    Ringkasan proyek

    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

    Instalasi

    npx markasui@latest add expandable-card

    Pemakaian

    <div class="grid grid-cols-2 gap-3">
        @foreach ($produk as $item)
            <x-markas.expandable-card :title="$item->nama" :description="$item->ringkasan" close-label="Tutup">
                <x-slot:media>
                    <img src="{{ $item->gambar }}" alt="" class="size-full object-cover" />
                </x-slot:media>
                <p class="text-base font-semibold">{{ $item->harga }}</p>
                <x-slot:footer>
                    <x-markas.button>Tambah ke keranjang</x-markas.button>
                </x-slot:footer>
            </x-markas.expandable-card>
        @endforeach
    </div>

    Butuh Alpine.js.

    import { Button } from "@/components/markas/Button";
    import { ExpandableCard } from "@/components/markas/ExpandableCard";
    
    <div className="grid grid-cols-2 gap-3">
      {produk.map((item) => (
        <ExpandableCard
          key={item.id}
          title={item.nama}
          description={item.ringkasan}
          closeLabel="Tutup"
          media={
            <img src={item.gambar} alt="" className="size-full object-cover" />
          }
          footer={<Button>Tambah ke keranjang</Button>}
        >
          <p className="text-base font-semibold">{item.harga}</p>
        </ExpandableCard>
      ))}
    </div>;
    <template>
      <div class="grid grid-cols-2 gap-3">
        <ExpandableCard
          v-for="item in produk"
          :key="item.id"
          :title="item.nama"
          :description="item.ringkasan"
          close-label="Tutup"
        >
          <template #media>
            <img :src="item.gambar" alt="" class="size-full object-cover" />
          </template>
          <p class="text-base font-semibold">{{ item.harga }}</p>
          <template #footer>
            <Button>Tambah ke keranjang</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>

    Slot media dirender sekali dan tampil di kartu dan tampilan terbuka. Custom element kecil membuka dialog dan memainkan animasi membesar dan mengecil.

    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 ditaruh di ng-template markasCardMedia karena tampil dua kali. Elemen dengan atribut footer mengisi baris aksi.

    • Satu komponen merender satu kartu beserta dialognya. Susun beberapa kartu di grid atau daftar milikmu.
    • Saat dibuka, kartu diukur, dialog modal native ditampilkan, lalu dianimasikan dari kotak kartu ke tengah layar (FLIP). Saat ditutup animasinya diputar mundur dan kartu muncul kembali di tempatnya.
    • Escape, klik backdrop, dan tombol tutup semuanya menjalankan animasi menyusut. Fokus kembali ke kartu.
    • Slot media dirender dua kali, di kartu dan di dialog. Beri gambar alt="" bila judul sudah menamainya.
    • Atribut dan class jatuh ke tombol kartu.

    Props

    NamaTipeDefaultKeterangan
    titlestring-Judul kartu. Juga menjadi heading dan nama aksesibel tampilan detail.
    descriptionstring-Ringkasan singkat. Dipotong dua baris di kartu, tampil utuh saat terbuka.
    mediaBlade: named slot · React: ReactNode · Vue: #media slot-Gambar atau ilustrasi. Tinggi 112px di kartu dan 192px di tampilan detail.
    childrenBlade: default slot · React: children · Vue: default slot-Detail tambahan yang hanya tampil saat terbuka.
    footerBlade: named slot · React: ReactNode · Vue: #footer slot-Aksi di bagian bawah tampilan detail, misalnya Tambah ke keranjang.
    closeLabelstringCloseNama aksesibel tombol tutup.
    idstringautoId tombol kartu. Dialog memakai id yang sama dengan akhiran -dialog.
    markasCardMediang-template-Khusus Angular. Taruh media di <ng-template markasCardMedia> (impor ExpandableCardMedia), karena tampil di kartu dan tampilan terbuka. Elemen dengan atribut footer mengisi aksi.

    Aksesibilitas

    • Kartu adalah tombol asli dengan aria-haspopup dialog, jadi Enter dan Spasi membukanya.
    • Tampilan detail adalah dialog modal native yang dinamai oleh heading-nya. Fokus pindah ke dalam dan halaman di belakang menjadi inert.
    • Escape, klik backdrop, atau tombol tutup menutupnya, lalu fokus kembali ke kartu.
    • Saat reduced motion dialog terbuka dan tertutup seketika tanpa animasi tumbuh dan menyusut.

    Komponen terkait

    Komponen markasui lain dengan class yang sama di setiap framework.