Edit the markup and see actual FerroUI controls update. The example runtime loads only after you press Run example. The playground interprets XAML in the browser with a precompiled runtime; it cannot compile Rust, so declarative Rust views (builders, rsx!, components) run from the repository’s samples instead: cargo run -p hello-world-hooks, cargo run -p view-gallery, or cargo run -p todo-mvc. The controls you see here are the same ones a component creates.
Real controls, running in WebAssembly.
The runtime downloads when you press Run.
<StackPanel xmlns="https://github.com/ferroui" Spacing="12"> <TextBlock Text="A clear next step" FontSize="20" /> <Button Content="Continue" HorizontalAlignment="Left" /> <Button Content="Unavailable" IsEnabled="False" /></StackPanel>use ferroui::prelude::*;use ferroui::base::metadata::from_markup_value;use ferroui::markup_xaml_loader::FerroRuntimeXamlLoader;
#[repr(C)]pub struct App { base: Application,}
ferro_class!(App: Application);ferro_impl_classes!(App: FerroObjectImpl);
impl NewApplication for App { fn new_application() -> Ref<Self> { instantiate(Self { base: Application::construct() }) }}
impl ApplicationImpl for App { fn initialize(this: &Self) { Self::parent_initialize(this); ferroui::controls::register_types(); FerroRuntimeXamlLoader::register(); this.styles().add(FluentTheme::new().as_style()); }
fn on_framework_initialization_completed(this: &Self) { let lifetime = this.application_lifetime(); if let Some(desktop) = lifetime.as_ref().and_then(|l| l.as_classic_desktop_style_application_lifetime()) { let value = FerroRuntimeXamlLoader::load(include_str!("View.xaml"), None, None, None, false) .expect("Example XAML should load"); let view = from_markup_value::<Ref<Control>>(&Some(value)).expect("Example root must be a control"); let window = Window::new(); window.set_title(Some("FerroUI documentation example".to_owned())); window.set_width(560.0); window.set_height(420.0); window.set_padding(Thickness::uniform(24.0)); window.set_content(Some(Control::boxed(view))); desktop.set_main_window(Some(window)); } Self::parent_on_framework_initialization_completed(this); }}
fn main() -> std::process::ExitCode { let args: Vec<String> = std::env::args().skip(1).collect(); let result = AppBuilder::configure::<App>().use_platform_detect().start_with_classic_desktop_lifetime(&args); std::process::ExitCode::from(result as u8)}Explore layout
Section titled “Explore layout”Try changing the column definitions or preview width. Invalid markup leaves the last successful view in place.
Real controls, running in WebAssembly.
The runtime downloads when you press Run.
<Grid xmlns="https://github.com/ferroui" ColumnDefinitions="Auto,*" RowDefinitions="Auto,Auto" Margin="12"> <TextBlock Text="Name" Margin="0,0,16,12" /> <TextBox Grid.Column="1" PlaceholderText="Your name" /> <TextBlock Grid.Row="1" Text="Team" Margin="0,0,16,0" /> <TextBox Grid.Row="1" Grid.Column="1" PlaceholderText="Your team" /></Grid>use ferroui::prelude::*;use ferroui::base::metadata::from_markup_value;use ferroui::markup_xaml_loader::FerroRuntimeXamlLoader;
#[repr(C)]pub struct App { base: Application,}
ferro_class!(App: Application);ferro_impl_classes!(App: FerroObjectImpl);
impl NewApplication for App { fn new_application() -> Ref<Self> { instantiate(Self { base: Application::construct() }) }}
impl ApplicationImpl for App { fn initialize(this: &Self) { Self::parent_initialize(this); ferroui::controls::register_types(); FerroRuntimeXamlLoader::register(); this.styles().add(FluentTheme::new().as_style()); }
fn on_framework_initialization_completed(this: &Self) { let lifetime = this.application_lifetime(); if let Some(desktop) = lifetime.as_ref().and_then(|l| l.as_classic_desktop_style_application_lifetime()) { let value = FerroRuntimeXamlLoader::load(include_str!("View.xaml"), None, None, None, false) .expect("Example XAML should load"); let view = from_markup_value::<Ref<Control>>(&Some(value)).expect("Example root must be a control"); let window = Window::new(); window.set_title(Some("FerroUI documentation example".to_owned())); window.set_width(560.0); window.set_height(420.0); window.set_padding(Thickness::uniform(24.0)); window.set_content(Some(Control::boxed(view))); desktop.set_main_window(Some(window)); } Self::parent_on_framework_initialization_completed(this); }}
fn main() -> std::process::ExitCode { let args: Vec<String> = std::env::args().skip(1).collect(); let result = AppBuilder::configure::<App>().use_platform_detect().start_with_classic_desktop_lifetime(&args); std::process::ExitCode::from(result as u8)}The local playground deliberately supports a limited registered vocabulary and bundled resources. Use the complete application samples for native services and custom code.
Try a small change and check the result
Section titled “Try a small change and check the result”- Run the button example, then change
Contentto “Save changes” and run it again. - Set
IsEnabled="False"and confirm the control no longer activates. - In the Grid example, switch between
Auto,*and*,*columns and narrow the preview. - Introduce an unknown property to inspect its error, then reset the example.
This runner supplies a theme and supported type registration. A model binding such as {Binding SaveCommand} still needs an application model; typing it here does not create one. Follow the commands guide for that integration.
Public APIs and controls
Section titled “Public APIs and controls”- Button — content, enabled state, commands, and events.
- Grid — columns, rows, and attached layout properties.
- XAML syntax and layout explain the edits; builders, rsx! & signals writes the same views in Rust.