</placeholders>

Collection of web components used as placeholders

Features

Usage

Insert the following tags to your HTML page:
<script
  type="module"
  src="https://unpkg.com/@placeholders/core@0.0.2/dist/esm/placeholders.js"></script>

Image placeholder

<placeholder-image></placeholder-image>

Attributes

height, width: The dimension in pixels
<placeholder-image width="400" height="200"></placeholder-image>
background-color?: The background color
<placeholder-image ... background-color="#bbb"></placeholder-image>
color?: The text color
<placeholder-image ... color="#fff"></placeholder-image>
text?: The content. By default, the text is generated from the width and height attributes.
<placeholder-image ... text="Hello World"></placeholder-image>

Text placeholder

<placeholder-text>...</placeholder-text>
It will turn each text inside the tag to a rectangle placeholder with the same size. For example
<placeholder-text>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor 
  incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud 
  exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute 
  irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla 
  pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia 
  deserunt mollit anim id est laborum.
</placeholder-text>
will display the following output:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Attributes

item-height?: The height in pixels of each rectangle
<placeholder-text item-height="8">...</placeholder-text>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
© 2021 Nguyen Huu Phuoc. All rights reserved