Components
- 手风琴
- 提示
- 警告对话框
- 宽高比
- 头像
- 徽章
- 面包屑导航
- 按钮
- 按钮组
- 日历 Calendar
- 卡片
- Carousel
- 图表 Chart
- 复选框
- 折叠面板
- 组合框
- 命令
- 上下文菜单
- 数据表格 Data Table
- 日期选择器 Date Picker
- 对话框 Dialog
- 抽屉
- 下拉菜单
- Empty
- 字段
- 悬停卡片
- 输入
- 输入组
- 输入 OTP
- 项目
- Kbd
- 标签
- 菜单栏
- 原生选择框
- 导航菜单 Navigation Menu
- 分页
- 弹出框
- 进度 Progress
- 单选框组
- 可调整大小
- 滚动区域 Scroll Area
- 选择框
- 分隔符 Separator
- 侧边栏 Sheet
- 侧边栏 Sidebar
- 骨架屏
- 滑块
- Sonner
- 加载指示器 Spinner
- 开关
- 表格
- 标签页 Tabs
- 文本域
- 吐司
- 切换按钮 Toggle
- 切换组
- 提示 Tooltip
- 排版
No Projects Yet
You haven't created any projects yet. Get started by creating your first project.
import { Button } from "@/components/ui/button"
import {
Empty,安装
pnpm dlx shadcn@latest add empty
使用方法
import {
Empty,
EmptyContent,
EmptyDescription,
EmptyHeader,
EmptyMedia,
EmptyTitle,
} from "@/components/ui/empty"<Empty>
<EmptyHeader>
<EmptyMedia variant="icon">
<Icon />
</EmptyMedia>
<EmptyTitle>暂无数据</EmptyTitle>
<EmptyDescription>未找到数据</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button>添加数据</Button>
</EmptyContent>
</Empty>示例
边框样式
使用 border 工具类创建一个带边框的空状态。
Cloud Storage Empty
Upload files to your cloud storage to access them anywhere.
import { Button } from "@/components/ui/button"
import {
Empty,背景
使用 bg-* 和 bg-gradient-* 工具类为空状态添加背景。
No Notifications
You're all caught up. New notifications will appear here.
import { Button } from "@/components/ui/button"
import {
Empty,头像
使用 EmptyMedia 组件在空状态中显示头像。
LR
User Offline
This user is currently offline. You can leave a message to notify them or try again later.
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import {头像组
使用 EmptyMedia 组件在空状态中显示头像组。
CNLRER
No Team Members
Invite your team to collaborate on this project.
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import {输入组
你可以在 EmptyContent 组件内添加 InputGroup 组件。
404 - Not Found
The page you're looking for doesn't exist. Try searching for what you need below.
/
Need help? Contact support
import {
Empty,
EmptyContent,API 参考
Empty
空状态的主要组件。包裹 EmptyHeader 和 EmptyContent 组件。
| 属性 | 类型 | 默认值 |
|---|---|---|
className | string |
<Empty>
<EmptyHeader />
<EmptyContent />
</Empty>EmptyHeader
EmptyHeader 组件包裹空状态中的媒体、标题和描述。
| 属性 | 类型 | 默认值 |
|---|---|---|
className | string |
<EmptyHeader>
<EmptyMedia />
<EmptyTitle />
<EmptyDescription />
</EmptyHeader>EmptyMedia
使用 EmptyMedia 组件展示空状态的媒体内容,如图标或图片。你也可以用它来显示其他组件,如头像。
| 属性 | 类型 | 默认值 |
|---|---|---|
variant | "default" | "icon" | default |
className | string |
<EmptyMedia variant="icon">
<Icon />
</EmptyMedia><EmptyMedia>
<Avatar>
<AvatarImage src="..." />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
</EmptyMedia>EmptyTitle
使用 EmptyTitle 组件显示空状态的标题。
| 属性 | 类型 | 默认值 |
|---|---|---|
className | string |
<EmptyTitle>暂无数据</EmptyTitle>EmptyDescription
使用 EmptyDescription 组件显示空状态的描述信息。
| 属性 | 类型 | 默认值 |
|---|---|---|
className | string |
<EmptyDescription>您还没有任何通知。</EmptyDescription>EmptyContent
使用 EmptyContent 组件显示空状态的内容,如按钮、输入框或链接。
| 属性 | 类型 | 默认值 |
|---|---|---|
className | string |
<EmptyContent>
<Button>添加项目</Button>
</EmptyContent>