Lewati ke konten
MarkasUI
Ketik untuk mencari

    Panduan

    MarkasUI

    Form

    Feedback

    Overlay

    Navigasi

    Data

    Section

    Animasi

    Latar

    Tombol

    Template

    Halaman

    Skeleton

    Placeholder berdenyut untuk konten yang sedang dimuat, ukurannya diatur lewat class.

    Loading profile
    Loading profile

    Skeleton

    <x-markas.skeleton shape="rect" class="h-4 w-48" />
    import { Skeleton } from "@/components/markas/Skeleton";
    
    <Skeleton shape="rect" className="h-4 w-48" />
    import Skeleton from "@/components/markas/Skeleton.vue";
    
    <Skeleton shape="rect" class="h-4 w-48" />
    <script lang="ts">
      import Skeleton from "$lib/components/markas/Skeleton.svelte";
    </script>
    
    <div
      class="flex items-center gap-4 rounded-lg border border-line bg-surface p-4"
      role="status"
    >
      <span class="sr-only">Loading profile</span>
      <Skeleton shape="circle" class="size-12 shrink-0" />
      <div class="grid flex-1 gap-2">
        <Skeleton class="h-4 w-2/3" />
        <Skeleton class="h-4 w-1/2" />
      </div>
    </div>
    ---
    import Skeleton from "@/components/markas/Skeleton.astro";
    ---
    
    <div
      class="flex items-center gap-4 rounded-lg border border-line bg-surface p-4"
      role="status"
    >
      <span class="sr-only">Loading profile</span>
      <Skeleton shape="circle" class="size-12 shrink-0" />
      <div class="grid flex-1 gap-2">
        <Skeleton class="h-4 w-2/3" />
        <Skeleton class="h-4 w-1/2" />
      </div>
    </div>
    import { Component } from "@angular/core";
    import { Skeleton } from "./markas/skeleton.component";
    
    @Component({
      selector: "markas-example",
      imports: [Skeleton],
      template: `
        <div
          class="flex items-center gap-4 rounded-lg border border-line bg-surface p-4"
          role="status"
        >
          <span class="sr-only">Loading profile</span>
          <div markas-skeleton shape="circle" class="size-12 shrink-0"></div>
          <div class="grid flex-1 gap-2">
            <div markas-skeleton class="h-4 w-2/3"></div>
            <div markas-skeleton class="h-4 w-1/2"></div>
          </div>
        </div>
      `,
    })
    export default class SkeletonExample {}

    Contoh

    Card

    Loading article
    Loading article
    Loading article
    Loading article
    Loading article

    Daftar

    Loading messages
    Loading messages
    Loading messages
    Loading messages
    Loading messages

    Profil

    Loading profile
    Loading profile
    Loading profile
    Loading profile
    Loading profile

    Teks

    Loading content
    Loading content
    Loading content
    Loading content
    Loading content

    Instalasi

    npx markasui@latest add skeleton

    Pemakaian

    <div class="flex items-center gap-4" role="status">
        <span class="sr-only">Memuat profil</span>
        <x-markas.skeleton shape="circle" class="size-12 shrink-0" />
        <div class="grid flex-1 gap-2">
            <x-markas.skeleton class="h-4 w-2/3" />
            <x-markas.skeleton class="h-4 w-1/2" />
        </div>
    </div>
    import { Skeleton } from "@/components/markas/Skeleton";
    
    <div className="flex items-center gap-4" role="status">
      <span className="sr-only">Memuat profil</span>
      <Skeleton shape="circle" className="size-12 shrink-0" />
      <div className="grid flex-1 gap-2">
        <Skeleton className="h-4 w-2/3" />
        <Skeleton className="h-4 w-1/2" />
      </div>
    </div>;
    <script setup lang="ts">
    import Skeleton from "@/components/markas/Skeleton.vue";
    </script>
    
    <template>
      <div class="flex items-center gap-4" role="status">
        <span class="sr-only">Memuat profil</span>
        <Skeleton shape="circle" class="size-12 shrink-0" />
        <div class="grid flex-1 gap-2">
          <Skeleton class="h-4 w-2/3" />
          <Skeleton class="h-4 w-1/2" />
        </div>
      </div>
    </template>
    <script lang="ts">
      import Skeleton from "$lib/components/markas/Skeleton.svelte";
    </script>
    
    <div class="flex items-center gap-4" role="status">
      <span class="sr-only">Loading profile</span>
      <Skeleton shape="circle" class="size-12" />
      <Skeleton class="h-4 w-1/2" />
    </div>
    ---
    import Skeleton from "@/components/markas/Skeleton.astro";
    ---
    
    <div class="flex items-center gap-4" role="status">
      <span class="sr-only">Loading profile</span>
      <Skeleton shape="circle" class="size-12" />
      <Skeleton class="h-4 w-1/2" />
    </div>
    import { Component } from "@angular/core";
    import { Skeleton } from "./markas/skeleton.component";
    
    @Component({
      selector: "app-profile-loading",
      imports: [Skeleton],
      template: `
        <div class="flex items-center gap-4" role="status">
          <span class="sr-only">Loading profile</span>
          <div markas-skeleton shape="circle" class="size-12"></div>
          <div markas-skeleton class="h-4 w-1/2"></div>
        </div>
      `,
    })
    export class ProfileLoading {}
    • Atur ukuran lewat class (h-4 w-1/2, size-12). Untuk lingkaran pakai shape="circle", bukan class rounded-full, karena tanpa tailwind-merge class radius yang bentrok bergantung pada urutan CSS.

    Props

    NamaTipeDefaultKeterangan
    shape'rect' | 'circle'rectSudut membulat 6px atau lingkaran penuh untuk avatar.
    classstring-Ukuran placeholder, misalnya h-4 w-1/2 atau size-12.

    Aksesibilitas

    • Setiap skeleton aria-hidden, jadi pembaca layar tidak membacakan kotak kosong.
    • Bungkus grup skeleton dengan role status dan teks sr-only seperti Memuat profil.
    • Animasi denyut dimatikan saat prefers-reduced-motion.

    Komponen terkait

    Komponen feedback lain dengan class yang sama di setiap framework.