Expand description
§Ferro JSON-UI
Stable JSON-based server-driven UI schema types for the Ferro framework.
This crate defines the typed foundation for JSON-UI: a declarative component system where the server sends JSON descriptions that are rendered to HTML. Components, actions, and visibility rules are all defined as Rust types with serde serialization and JSON Schema generation.
§Schema Structure
A JSON-UI view consists of:
- Components - UI elements (Card, Table, Form, Button, etc.)
- Actions - Handler references with confirmations and outcomes
- Visibility - Conditional rendering based on data conditions
- View - Top-level container with layout and title
§Example
use ferro_json_ui::{JsonUiView, ComponentNode, Component, CardProps};
let view = JsonUiView::new()
.title("Users")
.component(ComponentNode {
key: "header".to_string(),
component: Component::Card(CardProps {
title: "User Management".to_string(),
description: None,
children: vec![],
max_width: None,
footer: vec![],
}),
action: None,
visibility: None,
});
let json = view.to_json().unwrap();
assert!(json.contains("\"$schema\":\"ferro-json-ui/v1\""));Re-exports§
pub use action::Action;pub use action::ActionOutcome;pub use action::ConfirmDialog;pub use action::DialogVariant;pub use action::HttpMethod;pub use action::NotifyVariant;pub use component::ActionCardProps;pub use component::ActionCardVariant;pub use component::AlertProps;pub use component::AlertVariant;pub use component::AvatarProps;pub use component::BadgeProps;pub use component::BadgeVariant;pub use component::BreadcrumbItem;pub use component::BreadcrumbProps;pub use component::ButtonGroupProps;pub use component::ButtonProps;pub use component::ButtonType;pub use component::ButtonVariant;pub use component::CardProps;pub use component::CheckboxProps;pub use component::ChecklistItem;pub use component::ChecklistProps;pub use component::CollapsibleProps;pub use component::Column;pub use component::ColumnFormat;pub use component::Component;pub use component::ComponentNode;pub use component::DataTableProps;pub use component::DescriptionItem;pub use component::DescriptionListProps;pub use component::DropdownMenuAction;pub use component::DropdownMenuProps;pub use component::EmptyStateProps;pub use component::FormMaxWidth;pub use component::FormProps;pub use component::FormSectionProps;pub use component::GapSize;pub use component::GridProps;pub use component::HeaderProps;pub use component::IconPosition;pub use component::ImageProps;pub use component::InputProps;pub use component::InputType;pub use component::KanbanBoardProps;pub use component::KanbanColumnProps;pub use component::ModalProps;pub use component::NotificationDropdownProps;pub use component::NotificationItem;pub use component::Orientation;pub use component::PageHeaderProps;pub use component::PaginationProps;pub use component::PluginProps;pub use component::ProductTileProps;pub use component::ProgressProps;pub use component::SelectOption;pub use component::SelectProps;pub use component::SeparatorProps;pub use component::SidebarGroup;pub use component::SidebarProps;pub use component::Size;pub use component::SkeletonProps;pub use component::SortDirection;pub use component::StatCardProps;pub use component::SwitchProps;pub use component::Tab;pub use component::TableProps;pub use component::TabsProps;pub use component::TextElement;pub use component::TextProps;pub use component::ToastProps;pub use component::ToastVariant;pub use config::JsonUiConfig;pub use layout::register_layout;pub use layout::render_layout;pub use layout::DashboardLayout;pub use layout::DashboardLayoutConfig;pub use layout::Layout;pub use layout::LayoutContext;pub use layout::LayoutRegistry;pub use layout::SidebarSection;pub use plugin::collect_plugin_assets;pub use plugin::global_plugin_registry;pub use plugin::register_plugin;pub use plugin::registered_plugin_types;pub use plugin::with_plugin;pub use plugin::Asset;pub use plugin::CollectedAssets;pub use plugin::JsonUiPlugin;pub use plugin::PluginRegistry;pub use plugins::register_built_in_plugins;pub use plugins::MapPlugin;pub use render::render_to_html;pub use render::render_to_html_with_plugins;pub use render::RenderResult;pub use resolve::resolve_actions;pub use resolve::resolve_actions_strict;pub use resolve::resolve_errors;pub use resolve::resolve_errors_all;pub use view::JsonUiView;pub use view::SCHEMA_VERSION;pub use visibility::Visibility;pub use visibility::VisibilityCondition;pub use visibility::VisibilityOperator;
Modules§
- action
- Action declarations for JSON-UI components.
- component
- Component catalog for JSON-UI.
- config
- Configuration for JSON-UI rendering.
- data
- Data path resolution for JSON-UI.
- layout
- Layout system for JSON-UI page rendering.
- plugin
- Plugin system for JSON-UI custom interactive components.
- plugins
- Built-in plugin components for JSON-UI.
- render
- HTML render engine for JSON-UI views.
- resolve
- Resolvers for JSON-UI component trees.
- view
- Top-level view container for JSON-UI.
- visibility
- Conditional visibility rules for JSON-UI components.
Constants§
- COMPONENT_
CATALOG - Concise reference of all JSON-UI components for AI generation prompts.