- Components Overview
- Changelogv6.1.4
- General
- Layout
- Navigation
- Data Entry
- Data Display
- Feedback
- Other
Common props ref:Common props
This component is available since
antd@5.1.0.
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| width | The width of the watermark, the default value of content is its own width | number | 120 | |
| height | The height of the watermark, the default value of content is its own height | number | 64 | |
| inherit | Pass the watermark to the pop-up component such as Modal, Drawer | boolean | true | 5.11.0 |
| rotate | When the watermark is drawn, the rotation Angle, unit Β° | number | -22 | |
| zIndex | The z-index of the appended watermark element | number | 9 | |
| image | Image source, it is recommended to export 2x or 3x image, high priority (support base64 format) | string | - | |
| content | Watermark text content | string | string[] | - | |
| font | Text style | Font | Font | |
| gap | The spacing between watermarks | [number, number] | [100, 100] | |
| offset | The offset of the watermark from the upper left corner of the container. The default is gap/2 | [number, number] | [gap[0]/2, gap[1]/2] | |
| onRemove | Callback when the watermark is removed by DOM mutation | () => void | - | 6.0.0 |
| Property | Description | Type | Default | Version |
|---|---|---|---|---|
| color | font color | CanvasFillStrokeStyles.fillStyle | rgba(0,0,0,.15) | |
| fontSize | font size | number | 16 | |
| fontWeight | font weight | normal | lighter | bold | bolder | number | normal | |
| fontFamily | font family | string | sans-serif | |
| fontStyle | font style | none | normal | italic | oblique | normal | |
| textAlign | specify the text alignment direction | CanvasTextAlign | center | 5.10.0 |
When using an image watermark and the image loads abnormally, you can add content at the same time to prevent the watermark from becoming invalid (since 5.2.3).
<Watermarkheight={30}width={130}content="Ant Design"image="https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*lkAoRbywo0oAAAAAAAAAAAAADrJ8AQ/original"><div style={{ height:500}}/></Watermark>
overflow: hidden style is added since version 5.18.0?User can hide the watermark by setting the container height to 0 through the developer tool in the previous version. To avoid this situation, we added the overflow: hidden style to the container. When the container height changes, the content is also hidden. You can override the style to modify this behavior:
<Watermarkstyle={{ overflow:'visible'}}/>
The most basic usage.
Use content to set a string array to specify multi-line text watermark content.
Specify the image address via image. To ensure that the image is high definition and not stretched, set the width and height, and upload at least twice the width and height of the logo image address.
Preview the watermark effect by configuring custom parameters.
Use in Modal and Drawer.