Skeleton - 图1

Skeleton Svelte Component

Skeleton elements (aka UI Skeletons, Skeleton Screens, Ghost Elements) are basically “gray box” representations of UI that will be available soon. They are designed to improve perceived performance.

Skeleton Svelte component represents Skeleton component.

Skeleton Components

There are following components included:

  • SkeletonBlock
  • SkeletonText

Skeleton Properties

PropTypeDefaultDescription
<SkeletonBlock> properties
widthstring
number
Skeleton block width
heightstring
number
Skeleton block height
tagstringdivSkeleton block tag. Can be div or span
<SkeletonText> properties
widthstring
number
Skeleton text element width
heightstring
number
Skeleton text element height
tagstringspanSkeleton text element tag. Can be div or span

Examples

  1. <Page>
  2. <Navbar title="Menu" />
  3. <BlockTitle>Skeleton List</BlockTitle>
  4. <List mediaList class="skeleton-text">
  5. <ListItem
  6. title="Title"
  7. subtitle="Subtitle"
  8. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi lobortis et massa ac interdum."
  9. >
  10. <span slot="media">
  11. <SkeletonBlock style="width: 40px; height: 40px; border-radius: 50%" />
  12. </span>
  13. </ListItem>
  14. <ListItem
  15. title="Title"
  16. subtitle="Subtitle"
  17. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi lobortis et massa ac interdum."
  18. >
  19. <span slot="media">
  20. <SkeletonBlock style="width: 40px; height: 40px; border-radius: 50%" />
  21. </span>
  22. </ListItem>
  23. </List>
  24. <BlockTitle>Skeleton Card</BlockTitle>
  25. <Card
  26. class="skeleton-text"
  27. title="Card Header"
  28. content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi lobortis et massa ac interdum. Cras consequat felis at consequat hendrerit."
  29. footer="Card Footer"
  30. ></Card>
  31. <BlockTitle>Loading Effects</BlockTitle>
  32. <Block strong>
  33. <Row tag="p">
  34. <Button fill small round class="col" onClick={() => load('fade')}>Fade</Button>
  35. <Button fill small round class="col" onClick={() => load('blink')}>Blink</Button>
  36. <Button fill small round class="col" onClick={() => load('pulse')}>Pulse</Button>
  37. </Row>
  38. </Block>
  39. {#if loading}
  40. <List mediaList v-if="loading">
  41. {#each [1,2,3] as n, index (index)}
  42. <ListItem
  43. class={`skeleton-text skeleton-effect-${effect}`}
  44. title="Full Name"
  45. subtitle="Position"
  46. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi lobortis et massa ac interdum. Cras consequat felis at consequat hendrerit. Aliquam vestibulum vitae lorem ac iaculis. Praesent nec pharetra massa, at blandit lectus. Sed tincidunt, lectus eu convallis elementum, nibh nisi aliquet urna, nec imperdiet felis sapien at enim."
  47. >
  48. <span slot="media">
  49. <SkeletonBlock style="width: 40px; height: 40px; border-radius: 50%" />
  50. </span>
  51. </ListItem>
  52. {/each}
  53. </List>
  54. {:else}
  55. <List mediaList>
  56. <ListItem
  57. title="John Doe"
  58. subtitle="CEO"
  59. text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi lobortis et massa ac interdum. Cras consequat felis at consequat hendrerit. Aliquam vestibulum vitae lorem ac iaculis. Praesent nec pharetra massa, at blandit lectus. Sed tincidunt, lectus eu convallis elementum, nibh nisi aliquet urna, nec imperdiet felis sapien at enim."
  60. >
  61. <img src="https://placeimg.com/80/80/people/1" style="width: 40px; height: 40px; border-radius: 50%" slot="media" />
  62. </ListItem>
  63. <ListItem
  64. title="Jane Doe"
  65. subtitle="Marketing"
  66. text="Cras consequat felis at consequat hendrerit. Aliquam vestibulum vitae lorem ac iaculis. Praesent nec pharetra massa, at blandit lectus. Sed tincidunt, lectus eu convallis elementum, nibh nisi aliquet urna, nec imperdiet felis sapien at enim."
  67. >
  68. <img src="https://placeimg.com/80/80/people/2" style="width: 40px; height: 40px; border-radius: 50%" slot="media" />
  69. </ListItem>
  70. <ListItem
  71. title="Kate Johnson"
  72. subtitle="Admin"
  73. text="Sed tincidunt, lectus eu convallis elementum, nibh nisi aliquet urna, nec imperdiet felis sapien at enim."
  74. >
  75. <img src="https://placeimg.com/80/80/people/3" style="width: 40px; height: 40px; border-radius: 50%" slot="media" />
  76. </ListItem>
  77. </List>
  78. {/if}
  79. </Page>
  80. <script>
  81. import {Page, Navbar, BlockTitle, List, ListItem, SkeletonBlock, Card, Block, Row, Button} from 'framework7-svelte';
  82. let loading = false;
  83. let effect = null;
  84. function load(newEffect) {
  85. if (loading) return;
  86. effect = newEffect;
  87. loading = true;
  88. setTimeout(() => {
  89. loading = false;
  90. }, 3000);
  91. }
  92. </script>

← Sheet Modal

Smart Select →