| Tags |
<h-space> / <h-s> - horizontal gap.
<v-space> / <v-s> - vertical gap. |
<h-s>2rem</h-s>
<v-s>1rem</v-s>
|
size (attribute) |
CSS length for the gap. Applies to both components. Unitless numbers are treated as rem. Highest priority source. |
<h-s size="20rem"></h-s>
<v-s size="1.5rem"></v-s>
|
| Inner text |
Size value as element content. Hidden by the shadow slot so it is never rendered. Lower priority than the size attribute. |
<h-s>20rem</h-s>
<v-s>80px</v-s>
|
block (attribute, h-s only) |
Boolean. When present, switches <h-s> from inline-block to block display. |
<h-s block size="100%"></h-s>
|
thickness (attribute, h-s only) |
Optional visual height. Default 0, keeping the spacer invisible and avoiding baseline shift. |
<h-s size="8rem" thickness="2px"
style="background-color: orange;">
</h-s>
|
inline (attribute, v-s only) |
Boolean. When present, switches <v-s> from block to inline-block for use within a line. |
Line 1 <v-s inline>0.75rem</v-s> Line 2
|
--h-space-size (CSS var) |
Width of <h-s>. Lower priority than the size attribute and inner text. |
<h-s style="--h-space-size: var(--gap-xl)">
</h-s>
|
--h-thickness (CSS var) |
Visual thickness of <h-s>. Lower priority than the thickness attribute. |
<h-s style="--h-thickness: 2px;
background-color: rgba(255,165,0,.5)">
var(--gap-xl)
</h-s>
|
--v-space-size (CSS var) |
Height of <v-s>. Lower priority than the size attribute and inner text. |
<v-s style="--v-space-size: var(--gap-md)">
</v-s>
|
el.size (JS property) |
Gets or sets the size attribute. Assign null to remove it. Available on both components. |
const sp = document.querySelector('h-s');
sp.size = '4rem';
console.log(sp.size); // '4rem'
|
el.thickness (JS property, h-s only) |
Gets or sets the thickness attribute on <h-s>. |
const hs = document.querySelector('h-s');
hs.thickness = '3px';
|
| Live updates (behavior) |
A MutationObserver watches inner text and child changes. Reassigning element content after mount immediately recalculates the gap. |
const vs = document.querySelector('v-s');
vs.textContent = '3rem'; // applies immediately
|
| FOUC guard (behavior) |
A :not(:defined) style is auto-injected into <head> on script load. Raw size strings stay hidden until elements register. |
// no author action required —
// handled automatically by SpacerComponent.js
|