# starry-sky-ui
**Repository Path**: qqqsdx/starry-sky-ui
## Basic Information
- **Project Name**: starry-sky-ui
- **Description**: 星空UI:一个专注于打造优雅、简洁用户界面的开源项目,提供丰富的组件和灵活的定制选项,适用于Web和移动应用开发。
- **Primary Language**: JavaScript
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2026-06-12
- **Last Updated**: 2026-06-30
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Starry Sky UI — 轻量级 React UI 组件库
[](LICENSE)
[](https://gitee.com/qqqsdx/starry-sky-ui)
一套轻量级 React UI 组件库,API 参考 Ant Design 标准,提供基础通用组件。
适用于博客、后台管理、个人项目等场景。
📖 **文档地址:[https://www.adai.org.cn/ad-ui](https://www.adai.org.cn/ad-ui)**
🏠 **码云仓库:[https://gitee.com/qqqsdx/starry-sky-ui](https://gitee.com/qqqsdx/starry-sky-ui)**
## 安装
```bash
npm install starry-sky-ui
# 或
yarn add starry-sky-ui
# 或
pnpm add starry-sky-ui
```
## 快速开始
```tsx
import { Message, message, Select, Modal } from 'starry-sky-ui';
import type { SelectOption, ModalProps } from 'starry-sky-ui';
function App() {
return (
);
}
```
## 目录结构
```
src/components/ad-ui/
├── Message/
│ ├── index.tsx
│ └── index.scss
├── Modal/
│ ├── index.tsx
│ └── index.scss
├── Select/
│ ├── index.tsx
│ └── index.scss
├── Starfield/
│ ├── index.tsx
│ └── index.scss
├── Table/
│ ├── index.tsx
│ └── index.scss
├── Pagination/
│ ├── index.tsx
│ └── index.scss
├── types.ts # 公共类型导出
├── index.ts # 统一导出入口
└── README.md
```
---
## Message — 消息提示
全局消息提示,支持 `info`、`success`、`error`、`warning`、`loading` 五种类型,自动消失。
### 基本用法
```tsx
import { Message, message } from 'starry-sky-ui';
// 1. 在应用根节点挂载 Message 组件
function App() {
return (
{/* your app */}
);
}
// 2. 通过 message 对象调用
message.success('操作成功');
message.error('操作失败');
message.warning('警告提示');
message.info('这是一条提示');
message.loading('加载中...', 0); // duration=0 不自动消失
// 返回的 MessageInstance 支持 then 语法
message.loading('提交中...');
await submitForm();
message.success('提交成功');
```
### 通用 open 方法
```tsx
message.open({
type: 'success',
content: '自定义消息',
duration: 5000,
className: 'my-custom-class',
style: { fontSize: 16 },
onClose: () => console.log('closed'),
});
```
### 全局配置
```tsx
message.config({
top: 100, // 距离顶部距离,默认 20
duration: 5000, // 默认显示时长,默认 3000ms
maxCount: 3, // 最大显示数量,超出时移除最早的消息
getContainer: () => document.getElementById('msg-area')!,
});
```
### 销毁所有消息
```tsx
message.destroy();
```
### API 速查
| 方法 | 说明 |
|------|------|
| `message.info(content, duration?, onClose?)` | 信息提示 |
| `message.success(content, duration?, onClose?)` | 成功提示 |
| `message.error(content, duration?, onClose?)` | 错误提示 |
| `message.warning(content, duration?, onClose?)` | 警告提示 |
| `message.loading(content, duration?, onClose?)` | 加载提示 |
| `message.open(config)` | 通用打开(支持 className/style) |
| `message.config(config)` | 全局配置 |
| `message.destroy()` | 销毁所有消息 |
| 配置项 | 类型 | 默认值 | 说明 |
|--------|------|--------|------|
| `top` | `number` | `20` | 消息距离顶部距离 |
| `duration` | `number` | `3000` | 默认自动消失时长(ms),0 为不消失 |
| `maxCount` | `number` | `Infinity` | 最大显示数量 |
| `getContainer` | `() => HTMLElement` | — | 自定义挂载容器 |
---
## Select — 下拉选择器
通用下拉选择框,支持搜索、清除、受控/非受控、键盘导航、尺寸调整。
### 基本用法
```tsx
import { Select } from 'starry-sky-ui';
import type { SelectOption } from 'starry-sky-ui';
const options: SelectOption[] = [
{ label: 'React', value: 'react' },
{ label: 'Vue', value: 'vue', disabled: true },
{ label: 'Angular', value: 'angular' },
];
// 非受控