Watermark

Utilities & Providers
stable

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

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamWatermarkSchematic showing the watermark wrapper with the tiled overlay layer above the slot content. Wrapped content DRAFT DRAFT DRAFT DRAFT DRAFT DRAFT 1 2 3
Anatomy of <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

All props accepted by this component, with their type, default value and description.

text
string
UTF-8 text glyph tiled across the overlay. Required unless image is passed.
image
string
URL or data-URL of an image used as the repeated glyph. Takes precedence over text.
opacity
number
0.1
Opacity of the glyph (0–1), applied at SVG level so wrapped content stays at full opacity.
angle
number
-30
Rotation in degrees. Negative rotates counter-clockwise (−30° = classic top-left to bottom-right diagonal).
gap
number
120
Distance in CSS pixels between adjacent tiles. Smaller gap = denser pattern.
fontSize
number
16
Font size in CSS pixels for the text glyph. Ignored when image is used.
fontFamily
string
'inherit'
CSS font-family for the text glyph. inherit resolves to Helvetica/Arial (SVG data-URL does not inherit from the document).
color
string
'currentColor'
Color of the text glyph. currentColor does NOT work in data-URL SVGs — pass an explicit value for non-default cases.
fontWeight
number | string
400
CSS font-weight for the text glyph. Accepts standard CSS values (100–900, normal, bold).
zIndex
number
1
Z-index of the overlay layer. Use a value above wrapped content but below floating UI (menus, tooltips).
antiTamper
boolean
false
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.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'div'
Root HTML element rendered as the watermark wrapper.

API

Slots

Content slots exposed by this component.

#default
Wrapped content rendered beneath the diagonal overlay. Fully interactive when pointerEvents="none" (default).

API

Exposed members

Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.

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.

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

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

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

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.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Confidential text

vue

Dense pattern

vue

Anti-tamper

vue