Watermark
Absolutely-positioned repeating diagonal overlay wrapping a content slot. Renders a tiled SVG data-URL with text or image glyph. Supports anti-tamper MutationObserver, pointer-events pass-through and full visual customisation.
Structure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-watermark> — the root ① is position:relative; the overlay layer ② is absolutely inset with a tiled SVG data-URL background; the slot content ③ sits beneath (pointer-events passes through by default).- 1.origam-watermark
- Root wrapper. position: relative; display: block. Receives the tag prop.
- 2.origam-watermark__layer
- Absolutely-positioned overlay (inset: 0). background-image set to a data:image/svg+xml data-URL. pointer-events: none by default.
- 3[#default slot]
- Wrapped content rendered at z-index 0, below the overlay layer.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- textstring
- UTF-8 text glyph tiled across the overlay. Required unless image is passed.
- imagestring
- URL or data-URL of an image used as the repeated glyph. Takes precedence over text.
- opacitynumber0.1
- Opacity of the glyph (0–1), applied at SVG level so wrapped content stays at full opacity.
- anglenumber-30
- Rotation in degrees. Negative rotates counter-clockwise (−30° = classic top-left to bottom-right diagonal).
- gapnumber120
- Distance in CSS pixels between adjacent tiles. Smaller gap = denser pattern.
- fontSizenumber16
- Font size in CSS pixels for the text glyph. Ignored when image is used.
- fontFamilystring'inherit'
- CSS font-family for the text glyph. inherit resolves to Helvetica/Arial (SVG data-URL does not inherit from the document).
- colorstring'currentColor'
- Color of the text glyph. currentColor does NOT work in data-URL SVGs — pass an explicit value for non-default cases.
- fontWeightnumber | string400
- CSS font-weight for the text glyph. Accepts standard CSS values (100–900, normal, bold).
- zIndexnumber1
- Z-index of the overlay layer. Use a value above wrapped content but below floating UI (menus, tooltips).
- antiTamperbooleanfalse
- Installs a MutationObserver that re-injects the overlay if it is removed or hidden via DevTools. Dissuasive only — not a security feature.
- pointerEvents'none' | 'auto''none'
- none (default): clicks pass through the overlay to the wrapped content. auto: the overlay blocks interaction.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'div'
- Root HTML element rendered as the watermark wrapper.
API
Slots
Emplacements de contenu exposés par ce composant.
- #default
- Wrapped content rendered beneath the diagonal overlay. Fully interactive when pointerEvents="none" (default).
API
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- Ref<string>
- Reactive data-URL of the generated SVG tile. Can be used as a background-image in custom CSS.
- Ref<HTMLElement | null>
- Reference to the root wrapper element.
- Ref<HTMLElement | null>
- Reference to the overlay layer element. Used internally by the MutationObserver.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Default glyph color token (currentColor in data-URL context; override with explicit value).
- Low opacity level (very subtle).
- Medium opacity level (default).
- High opacity level (more prominent).
- Tight tile gap (dense pattern).
- Medium tile gap (default).
- Z-index of the overlay layer.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Notes
- The overlay is purely visual. It carries aria-hidden="true" so screen readers skip it entirely — only the wrapped content is announced.
- With pointerEvents="none" (default), all interactive elements inside the slot remain keyboard and pointer accessible.
- The watermark is NOT a security feature. antiTamper adds dissuasion only — a determined user can always disable JS. Do not rely on it to protect sensitive data.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Confidential text
Dense pattern
Anti-tamper