Building a Settings Application
The Rust gxwi::settings module builds settings interfaces from HTML
helpers. It supplies layout and controls; your application owns state,
validation, backend calls, and authorization.
Before you start #
Create an application using App and implement Live for its page state.
Choose the backend operation and permissions each control needs. Use the
SDK's checked example and Rust API documentation for complete signatures.
Build the page #
- Register
settings::stylesheetwith the application before adding your own stylesheet. - Choose
settings::windowfor a page with navigation orsettings::singlefor one section without navigation. - Build navigation with stable section identifiers. Handle the
sectionevent by validating the requested identifier and selecting its page. - Assemble controls with settings helpers and named fields. Escape text that comes from users, files, or services before embedding it in HTML.
- Show the effective backend state and an actionable error when an operation fails.
The kit adapts navigation to narrow views. It does not require the process to track a browser's viewport.
Apply changes deliberately #
Use immediate application for controls such as a switch when the operation is reversible and failure can be shown clearly. Restore the displayed field if the backend refuses the change.
Use an explicit Apply action for a group of typed values that must be validated together. Validate the complete proposed state before submitting it. Rendering a success message before the backend accepts the operation misrepresents the effective configuration.
For a destructive operation, ask for confirmation and focus the safe choice. A confirmation is not authorization: the backend still checks the caller's rights.
Verify the result #
Exercise successful changes, refused access, invalid values, and backend failure. Open the same surface in two browser views and check that both reflect accepted state. Verify keyboard operation and a narrow viewport.