瑚琏 Hulianv0.93.5413 组件0 组件
  • 开始
  • 组件
  • 区块
  • 页面
  • 模版
  • 更新
中文EN
  • 组件组件
  • 主题主题

背景

  • 点阵背景
  • 网格背景
  • 斜条纹背景
  • 径向辉光背景
  • 渐隐遮罩
  • 复古透视网格
  • 同心脉冲圆环
  • 流星雨
  • 极光渐变背景
  • 交互粒子场
  • 闪烁网格
  • 噪声波浪
  • 丝绸流动背景
  • 虹彩光泽背景
  • 流动丝线背景
  • 指针交互光球
  • 液态铬背景
  • 螺旋油彩
  • 彩球球池
  • 流动光柱
  • 多色流场
  • 暗色帷幕
  • 抖动波纹
  • 交互式点阵背景
  • 火焰邪眼
  • 故障终端雨
  • 铁磁流体
  • 漂浮线束
  • 视差星河
  • 渐变百叶窗
  • 颗粒渐变
  • 网格扭曲
  • 倾斜网格视差
  • 扫描网格
  • 跃迁隧道
  • 字符故障雨
  • 光束坠落
  • 电弧极光
  • 体积光柱
  • 光束放射
  • 波纹线阵
  • 液态色域
  • 点阵翻涌
  • 像素雪场
  • 等离子流动
  • 等离子波
  • 棱镜分光
  • 棱镜光爆
  • 雷达扫描
  • 涟漪网格
  • 几何网格
  • 侧光束
  • 柔和极光

覆盖特效

  • 边框光束
  • 流光边框
  • 反光悬停
  • 放大镜
  • 动效光束
  • 轨道环绕
  • 渐进模糊
  • 聚光卡片
  • 逐级揭示
  • 反重力粒子
  • 果冻光标
  • 点击火花
  • 准星十字线
  • 通电边框
  • 幽灵拖尾光标
  • 渐进贴边模糊
  • 光标图片拖尾
  • 激光束
  • 魔法光环
  • 指针磁吸
  • 磁力线网格
  • 黏液融球
  • 液态金属漆面
  • 轨道环绕
  • 像素余晖拖尾
  • 像素转场卡
  • 飘带跟随
  • 模糊形状高光
  • 流体溅射光标
  • 流星描边按钮
  • 可拖拽贴纸
  • 准星光标
  • 立方体阵列
  • 视差倾斜包裹器
  • 发光边框卡
  • 玻璃图标网格
  • 液态玻璃折射面
  • 挂绳工牌
  • 3D 模型舞台
  • 流体玻璃

DotPattern

dot-pattern

铺一层跟随主题配色的点阵背景,点距可调

用法

基础用法

在 relative 容器内放一层 DotPattern 即得点阵背景,默认 16px 单元、text-border 吃主题。

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <DotPattern />
</div>

调整密度与点径

width/height 控制单元间距,cr 控制点半径——加大间距、加粗点即得疏朗大点阵。

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <DotPattern width={28} height={28} cr={1.6} />
</div>

改色(吃主题)

点色取 currentColor,用 text-* 工具类即可换色,明暗主题自动适配。

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <DotPattern className="text-primary" />
</div>

遮罩渐隐

叠加 mask-image 让点阵向边缘淡出,常用于 hero/卡片背景,避免硬边。

tsx
<div className="relative h-48 w-full overflow-hidden rounded-xl border border-border bg-surface">
  <DotPattern className="[mask-image:radial-gradient(closest-side,black,transparent)]" />
</div>

何时用

给卡片/区块/Hero 加点阵纹理底。要点状纹理用本组件;要线网格用 GridPattern,斜条纹用 StripedPattern,径向辉光用 Spotlight。

导入

ts
import { DotPattern } from "@hulianui/ui"

Props

名称类型默认说明
widthnumber16平铺单元宽
heightnumber16平铺单元高
cxnumber1点在单元内的 x 偏移
cynumber1点在单元内的 y 偏移
crnumber1点半径
xnumber0pattern 整体 x 偏移
ynumber0pattern 整体 y 偏移
继承 ComponentPropsWithoutRef<"svg">(className 等)。颜色取 currentColor,用 text-* 工具类控制(如 text-muted-foreground)。

禁忌 / 坑

  • 内部 absolute inset-0 铺满父级,必须放在 relative(且通常 overflow-hidden)定位容器内,否则无法定位/会溢出。
  • 颜色靠 currentColor,用 text-* 改色而非 fill。

相关

GridPattern · StripedPattern · Spotlight · RetroGrid · Ripple · Meteors

Playground

<div className="relative">
  <DotPattern width={16} cr={1} />
</div>
上一个引用来源装饰下一个网格背景

本页

  • 用法
  • 文档
    • 何时用
    • 导入
    • Props
    • 禁忌 / 坑
    • 相关
  • Playground