-
Notifications
You must be signed in to change notification settings - Fork 9
Component EmptyState
MeowLynxSea edited this page Jan 25, 2026
·
3 revisions
An empty state panel: icon + title + description + optional action slot.
This is a component-level primitive for consistent “no data / nothing found” UI.
- Empty lists: “No servers yet”, “No results”, “No mods installed”
- Post-filter / post-search empty results
Not a good fit:
- Error states with technical details (prefer a dedicated error panel or toast)
-
empty_state(): constructor (uses caller location to generate a default id) -
id(...): stable identity override -
icon(Icon): override icon -
title("..."): set title text -
description("..."): set description text -
action(IntoElement): optional action slot (usually aButton) -
max_width(px(...)): constrain width
Helper:
-
empty_state_primary_action("..."): convenience builder for a primary action button
- Background:
theme.surface.raised(aligned with Modal panel) - Border:
theme.border.default - Max width:
420px
use yororen_ui::component::{empty_state, empty_state_primary_action};
let view = empty_state()
.title("没有数据")
.description("当前列表为空。你可以创建一个新的条目,或调整筛选条件。")
.action(empty_state_primary_action("新建"));Guide-Recipes-EmptyState
Yororen UI v0.3.0 · repository · Apache-2.0 · This wiki documents Yororen UI v0.3.0.
This wiki documents Yororen UI v0.3.0 — the headless-core, swappable-renderer build.