@hirohe/react-watermark
Version:
A React Component to wrap watermark text on child component, using generated svg as background-image
68 lines (67 loc) • 1.6 kB
TypeScript
import React, { CSSProperties } from 'react';
/**
* props for Watermark component
*/
export interface WatermarkProps {
/**
* show watermark or not
*/
show?: boolean;
/**
* text content of watermark
*/
text: string;
/**
* text color of watermark, apply to svg fill attribute
*/
textColor?: string;
/**
* text size of watermark, apply to svg font-size attribute
*/
textSize?: number;
/**
* font family of watermark, apply to svg font-family attribute
*/
fontFamily?: string;
/**
* line height of watermark, it will be applied to svg tspan dy attribute
* only works when multiline is true
*/
lineHeight?: string;
/**
* whether watermark is multiline or not
* text will be split by '\n', and wrapped by svg tspan
* default is false
*/
multiline?: boolean;
/**
* opacity of watermark, apply to svg opacity attribute
*/
opacity?: number;
/**
* rotate degree of watermark, apply to svg transform attribute
*/
rotate?: number;
/**
* gutter between text
*/
gutter?: number;
/**
* style of wrapper element
*/
wrapperStyle?: CSSProperties;
/**
* element of wrapper, default is div
*/
wrapperElement?: React.ElementType;
/**
* overlapping level of watermark element
*/
zIndex?: number;
/**
* in react18, FC needs a definition of children
*/
children?: React.ReactNode;
}
declare const Watermark: React.FC<WatermarkProps>;
export default Watermark;