Expand description
通用 UI 原子与全部 class 常量(卡片 / 按钮 / 徽章 / 分页 / spinner / checkbox)。 任何 inline Tailwind class 字符串上线前,先在此查是否已有常量。 通用 UI 原子组件与类名常量。
提供跨页面共享的样式常量(卡片、按钮、徽章外层等)与可复用组件 (分页导航、状态徽章、空状态)。样式常量用于消除散落在各页面的重复 Tailwind 类字符串;组件用于封装结构固定的 UI 单元。
与 forms.rs(表单控件)并列,本模块聚焦通用展示类原子。
Modules§
- composer 🔒
- 输入栏:圆角外壳 + 输入框 + 陶土发送键。
- controls 🔒
- Buttons and native selection controls.
- display 🔒
- Badges, avatars, placeholders and CSS tooltips.
- feedback 🔒
- 全站提示(Toast):操作结果的短暂反馈,出现在屏幕底部居中;区块加载失败卡片。
- icons 🔒
- Lucide 图标(ISC 许可,见
public/icons/LICENSE-lucide.txt)。 - menu 🔒
- 操作菜单:「⋯」等按钮触发的一列操作。
- navigation 🔒
- Pagination, tabs and navigable tag chips.
- segmented 🔒
- 分段控件:胶囊轨道 + 弹簧滑块。
- sheet 🔒
- 抽屉:手机上的导航与目录面板。底部抽屉样式见 shell.css 的
.sheet, 左侧抽屉(后台导航)见 admin.css 的.side-sheet。 - styles 🔒
- 共享样式常量与 spinner 标记。
- surfaces 🔒
- Positioned popovers, modal shells and the danger confirm dialog.
Structs§
- Bottom
Sheet Props - Props for the
BottomSheetcomponent. - Breadcrumb
Props - Props for the
Breadcrumbcomponent. - Button
Props - Props for the
Buttoncomponent. - Checkbox
Props - Props for the
Checkboxcomponent. - Composer
Input Props - Props for the
ComposerInputcomponent. - Composer
Props - Props for the
Composercomponent. - Composer
Send Props - Props for the
ComposerSendcomponent. - Confirm
Dialog Props - Props for the
ConfirmDialogcomponent. - Crumb
- 面包屑中的一级。最后一级是当前页(不可点击,标
aria-current);中间级to为None时是不可点击的分组名(如后台的「内容」)。 - Icon
Button Props - Props for the
IconButtoncomponent. - Icon
Props - Props for the
Iconcomponent. - Image
Placeholder Props - Props for the
ImagePlaceholdercomponent. - Load
Error Props - Props for the
LoadErrorcomponent. - Menu
Item - 菜单里的一项。
id回传给on_select,用于区分点了哪一项。 - Menu
Props - Props for the
Menucomponent. - Modal
Shell Props - Props for the
ModalShellcomponent. - Pagination
Props - Props for the
Paginationcomponent. - Popover
Props - Props for the
Popovercomponent. - Radio
Props - Props for the
Radiocomponent. - Segmented
Control Props - Props for the
SegmentedControlcomponent. - Segmented
Item - 分段控件的一项:值、文字,可选图标与数量。
- Sheet
Close - 抽屉内容用来关闭抽屉(带退出动画、焦点还给触发按钮)。
- Side
Sheet Props - Props for the
SideSheetcomponent. - Status
Badge Props - Props for the
StatusBadgecomponent. - Status
DotProps - Props for the
StatusDotcomponent. - Table
Pager Props - Props for the
TablePagercomponent. - TagChip
Props - Props for the
TagChipcomponent. - Toast
Region Props - Props for the
ToastRegioncomponent. - Toaster
- 发提示的句柄,经
use_toast取得。 - Tooltip
Props - Props for the
Tooltipcomponent. - User
Avatar Props - Props for the
UserAvatarcomponent.
Enums§
- Button
Size - 按钮尺寸:XS 26px、SM 30px、MD 34px、LG 40px。
- Button
Variant - 按钮样式,对应 styles/components/ui.css 的
.btn-*。 - Composer
Size - Icon
Name - Lucide 图标名。渲染见
super::Icon。 - Segmented
Kind - 语义:Tabs = tablist/tab + aria-selected(切换视图、筛选); Radio = radiogroup/radio + aria-checked(设置取值)。
- Segmented
Size - Toast
Tone - 提示的语气。
Constants§
- BADGE_
BASE - 徽章底座(
.badge,中性色);语气追加badge-clay/badge-success/badge-warning/badge-danger。 - BTN_
SECONDARY - 次要按钮:浅灰底。
- EXIT_
ANIM_ MS - 弹窗关闭/元素退出动画统一时长(ms),与 base.css 的 .modal-overlay / .modal-panel 关闭过渡对应; 调用方需要在动画播放完毕后再真正卸载/摘除元素时复用本常量。
- SPINNER_
SVG - 行内加载 spinner:环形渐变 + 自旋动画,用 currentColor 继承文字色。
Functions§
- Bottom
Sheet - 底部抽屉。
- Breadcrumb
- 面包屑:
关于 / 组件图鉴 / 复选框,最后一级为当前页并在过长时截断。 - Button
- 通用按钮。
- Checkbox
- 带勾画动画的复选框:对勾 SVG 用 stroke-dashoffset 描边绘制 + scale 弹入。
- Composer
- 输入栏外壳:20px(Sm 为 14px)圆角、surface-3、发丝线 + composer 阴影, 聚焦时 Clay 双环。
- Composer
Input - 输入栏里的输入框:单行 input 或多行 textarea(
field-sizing: content), 自带输入法守卫。 - Composer
Send - 陶土发送键。不给
onclick时为type=submit。 - Confirm
Dialog - 危险操作确认对话框(
alertdialog):左侧 danger 图标、标题与说明,底栏「取消」与 danger 主按钮。点确认先关闭再回调on_confirm,执行与结果提示由调用方负责。title同时作为面板的无障碍名称,同一时刻打开的对话框标题不能重复。 - Icon
- 内联 SVG 图标。
- Icon
Button - 只有图标的方形按钮。
label必填:作为读屏名称,同时显示为悬浮提示;shortcut会跟在提示文字后面。 - Image
Placeholder - 封面与头像加载失败时的图片占位:Lucide
image-off图标,尺寸与颜色由class控制。 - Load
Error - 区块加载失败卡片:页面其余部分照常显示,只有出错的区块换成它;重试在原位完成。
- Menu
- 图标按钮触发的操作菜单。
- Modal
Shell - 通用弹窗外壳:遮罩 + 面板容器 + 开合动画状态机(
opened/closing/ 退出计时)。 - Pagination
- 前台列表分页:上一页 / 下一页描边按钮与居中的「当前 / 总」页码,首尾页不渲染越界按钮。
- Popover
- 受控式通用 Popover(浮层)组件。
- Radio
- 主题化单选框,与 Checkbox 使用相同尺寸、主题色和焦点描边。
- Segmented
Control - 分段控件。
- Side
Sheet - 左侧抽屉。
- Status
Badge - 状态徽章组件。
- Status
Dot - 状态圆点:6px 圆点 + 文字(
.status-dot),后台列表与面板的状态标识。 - Table
Pager - 表格底栏分页:左侧「第 21–40 篇,共 57 篇」,右侧上一页、页码与下一页图标按钮。 只有一页时只显示总数。
- TagChip
- 标签芯片组件:统一软底标签、卡片胶囊与文字链接的展示。
- Toast
Region - 提示显示区:固定在屏幕底部居中,
aria-live让读屏软件播报新提示。 - Tooltip
- 悬浮提示:深色小气泡,悬停 300ms 后出现,键盘聚焦触发器时立即出现。
- User
Avatar - 用户头像:加载失败显示图片占位,无图回退展示名首字符(陶土浅底)。
- button_
class - 组合按钮类名,供
<a>、label等需要按钮外观的非按钮元素使用。 - provide_
toaster - 在应用根部提供提示上下文(
App调用一次)。 - use_
sheet_ close - 在
BottomSheet/SideSheet的子组件里取得关闭句柄。 - use_
toast - 取得发提示的句柄。