Popconfirm 气泡确认框
反馈组件
气泡确认框 — Chaos UI 的反馈组件。
何时使用
需要气泡确认框功能时使用本组件。
代码示例
基础用法
tsx
import { Popconfirm } from "@/components/ui/popconfirm"
export function Basic() {
return <Popconfirm />
}样式变体
对齐
| align | 说明 | 默认 |
|---|---|---|
center | ✓ | |
start | ||
end |
side
| side | 说明 | 默认 |
|---|---|---|
top | ✓ | |
bottom | ||
left | ||
right |
API / Props
Popconfirm
| Prop | Type | Default | 说明 |
|---|---|---|---|
className | string | — | 自定义样式类名 |
open | boolean | — | Whether the popconfirm is open |
onOpenChange | () => void | — | Called when open state changes |
title | React.ReactNode | — | Title text |
description | React.ReactNode | — | Description text |
confirmText | string | Confirm | Text for confirm button |
cancelText | string | Cancel | Text for cancel button |
onConfirm | () => void | — | Called when confirmed |
onCancel | () => void | — | Called when cancelled |
| ...rest | React.ComponentProps<"div"> | — | 透传 <div> 原生属性 |
注意事项
- Client Component: 使用
"use client",依赖 React hooks/状态,需在客户端渲染。 - CVA 变体: 通过
class-variance-authority管理样式变体,类型安全。变体对象可导出复用。 - 原生属性: 继承所有
<div>原生 HTML 属性。
📘 完整交互式示例与控件属性请查看 Storybook 文档。