For Tailwind CSS v3 docs, click here.

Pattern Background

Simple animated pattern background to make your sections stand out.

Grid background with dot

通过 CLI 安装

npm
pnpm
bun
yarn
npx shadcn-vue@latest add "https://registry.inspira-ui.com/pattern-background.json"

手动安装

在同一个文件中,复制并粘贴以下代码:

PatternBackground.vue
index.ts

示例

Grid background with big dot and ellipse on top

Grid background without animation

Small grid background with animation

API

Prop 名称类型默认值描述
animatebooleanfalseSet true if you want to animate the background.
directiontop | bottom | left | right | top-left | top-right | bottom-left | bottom-righttopDirection of the animation movement. You can use the const PATTERN_BACKGROUND_DIRECTION.
directiongrid | dotgrid类型 of pattern. You can use the const PATTERN_BACKGROUND_VARIANT.
sizexs | sm | md | lgmdSize of the background pattern.
maskellipse | ellipse-topellipseAdd a mask over the background pattern. You can use the const PATTERN_BACKGROUND_MASK.
speednumber10000Duration of the animation in ms, the bigger it is, the slower the animation. (20000 slower than 5000). You can use the const PATTERN_BACKGROUND_SPEED.

Custom variants, values and constants

You can customize your needs directly within the index.ts file. See code below.

感谢