Kumo Svelte
  • Home
  • Installation
  • Colors
  • Accessibility
  • Changelog
  • Autocomplete
  • Badge
  • Banner
  • Breadcrumbs
  • Button
  • Checkbox
  • Clipboard Text
  • Cloudflare Logo
  • CodeHighlighted
  • Collapsible
  • Combobox
  • Command Palette
  • Date Picker
  • Dialog
  • Dropdown
  • Empty
  • Flow
  • Grid
  • Input
  • InputArea
  • InputGroup
  • Label
  • Layer Card
  • Link
  • Loader
  • MenuBar
  • Meter
  • Pagination
  • Popover
  • Radio
  • Select
  • Sensitive Input
  • Sidebar
  • Skeleton Line
  • Switch
  • Table
  • Table of Contents
  • Tabs
  • Text
  • Toast
  • Toolbar
  • Tooltip
  • Charts
  • Colors
  • Timeseries
  • Maps
  • Sankey
  • Custom Chart
  • Page Header
  • Resource List
  • Delete Resource
Skeleton Line
kumo-svelte

Skeleton Line

A skeleton loading placeholder for text content.

<script lang="ts">
  import { SkeletonLine } from "kumo-svelte/components/loader";
</script>

<div class="flex w-64 flex-col gap-3">
  <SkeletonLine />
  <SkeletonLine />
  <SkeletonLine />
</div>

Import

import { SkeletonLine } from "kumo-svelte/components/loader";

Custom Widths

Control the randomized width range for more natural-looking skeletons.

<script lang="ts">
  import { SkeletonLine } from "kumo-svelte/components/loader";
</script>

<div class="flex w-64 flex-col gap-3">
  <SkeletonLine minWidth={80} maxWidth={100} />
  <SkeletonLine minWidth={60} maxWidth={80} />
  <SkeletonLine minWidth={40} maxWidth={60} />
</div>

Custom Height

Override the default height using Tailwind utility classes via class. The default height is 0.5rem.

<script lang="ts">
  import { SkeletonLine } from "kumo-svelte/components/loader";
</script>

<div class="flex w-64 flex-col gap-3">
  <SkeletonLine class="h-2" />
  <SkeletonLine class="h-4" />
  <SkeletonLine class="h-6" />
  <SkeletonLine class="h-8" />
</div>

Block Height

Use blockHeight to set the height of a container that vertically centers the skeleton line. Useful when replacing text of a known line height. Accepts a number, treated as pixels, or any CSS string value.

32px
48px
64px
<script lang="ts">
  import { SkeletonLine } from "kumo-svelte/components/loader";
</script>

<div class="flex w-64 flex-col gap-1">
  <div class="relative">
    <div class="absolute top-0 right-full bottom-0 mr-2 flex items-center border-r-2 border-kumo-fill pr-2 text-sm">32px</div>
    <SkeletonLine blockHeight={32} />
  </div>
  <div class="relative">
    <div class="absolute top-0 right-full bottom-0 mr-2 flex items-center border-r-2 border-kumo-fill pr-2 text-sm">48px</div>
    <SkeletonLine blockHeight={48} />
  </div>
  <div class="relative">
    <div class="absolute top-0 right-full bottom-0 mr-2 flex items-center border-r-2 border-kumo-fill pr-2 text-sm">64px</div>
    <SkeletonLine blockHeight={64} />
  </div>
</div>

Card Loading State

Use skeleton lines to create loading states for cards and content areas.

<script lang="ts">
  import { SkeletonLine } from "kumo-svelte/components/loader";
</script>

<div class="w-64 rounded-lg p-4 ring ring-kumo-hairline">
  <div class="mb-4 h-4">
    <SkeletonLine minWidth={40} maxWidth={60} />
  </div>
  <div class="flex flex-col gap-2">
    <SkeletonLine />
    <SkeletonLine />
    <SkeletonLine minWidth={50} maxWidth={70} />
  </div>
</div>

API Reference

SkeletonLine

PropTypeDefault
blockHeightstring | number—
classstring—
maxDelaynumber0.5
maxDurationnumber1.7
maxWidthnumber100
minDelaynumber0
minDurationnumber1.3
minWidthnumber30

On this page

  • Import
  • Custom Widths
  • Custom Height
  • Block Height
  • Card Loading State
  • API Reference
    • SkeletonLine