Skip to content

Mask

Mask crops the content of the element to common shapes.

Examples

Squircle

The mask can crop the shape of squircle.

Code
vue
<script setup lang="ts">
import { BaseMask } from '@point-hub/papp'
</script>

<template>
  <component :is="BaseMask" shape="squircle" src="https://placehold.co/150" />
</template>

Diamond

The mask can crop the shape of diamond.

Code
vue
<script setup lang="ts">
import { BaseMask } from '@point-hub/papp'
</script>

<template>
  <component :is="BaseMask" shape="diamond" src="https://placehold.co/150" />
</template>

Reuleaux Triangle

The mask can crop the shape of reuleaux triangle.

Code
vue
<script setup lang="ts">
import { BaseMask } from '@point-hub/papp'
</script>

<template>
  <component :is="BaseMask" shape="reuleaux-triangle" src="https://placehold.co/150" />
</template>

Heart

The mask can crop the shape of heart.

Code
vue
<script setup lang="ts">
import { BaseMask } from '@point-hub/papp'
</script>

<template>
  <component :is="BaseMask" shape="heart" src="https://placehold.co/150" />
</template>

Octagon

The mask can crop the shape of octagon.

Code
vue
<script setup lang="ts">
import { BaseMask } from '@point-hub/papp'
</script>

<template>
  <component :is="BaseMask" shape="octagon" src="https://placehold.co/150" />
</template>

Hexagon

The mask can crop the shape of hexagon.

Code
vue
<script setup lang="ts">
import { BaseMask } from '@point-hub/papp'
</script>

<template>
  <component :is="BaseMask" shape="hexagon" src="https://placehold.co/150" />
  <component :is="BaseMask" shape="hexagon-2" src="https://placehold.co/150" />
</template>

Star

The mask can crop the shape of star.

Code
vue
<script setup lang="ts">
import { BaseMask } from '@point-hub/papp'
</script>

<template>
  <component :is="BaseMask" shape="star" src="https://placehold.co/150" />
  <component :is="BaseMask" shape="star-2" src="https://placehold.co/150" />
</template>

Mask API

Types

ts
export type BaseMaskShapeType =
  | 'squircle'
  | 'diamond'
  | 'reuleaux-triangle'
  | 'hexagon'
  | 'hexagon-2'
  | 'heart'
  | 'octagon'
  | 'star'
  | 'star-2'

Props

NameTypeDefaultDescription
srcstringImage source is required.
shapeBaseMaskShapeTypeImage masking shape.

Released under the MIT License.