---
title: "oneui cookbook"
url: https://recursiveai.org/oneui/cookbook/
description: "10 OneUI recipes, each with complete code."
version: "1.0.0"
---

# oneui cookbook

## HTML components

- [Build a reactive HTML component with C# state](https://recursiveai.org/oneui/cookbook/create-html-component-with-csharp-state/index.md): Build a reactive HTML component with C# state in OneUI. Compile a counter template, click its button in memory, and see the rendered text update.
- [Pass parameters to a child HTML component in C#](https://recursiveai.org/oneui/cookbook/pass-parameters-to-child-component/index.md): Pass a typed parameter from a parent template to a child HTML component with OneUI. See the child update when its parent’s C# state changes.
- [Conditionally render HTML in a C# component template](https://recursiveai.org/oneui/cookbook/render-conditional-content-in-template/index.md): Conditionally render HTML in a C# component template with OneUI. Use if and else branches to switch between saved and unsaved messages.
- [Render a list in a C# HTML component template](https://recursiveai.org/oneui/cookbook/render-list-in-component-template/index.md): Render a C# collection as repeated HTML in a OneUI component. Use a keyed template to render list items and keep their identity when reordered.
- [Two-way bind an HTML input to C# state](https://recursiveai.org/oneui/cookbook/two-way-bind-input-value/index.md): Two-way bind an HTML input to C# state with OneUI’s bind:value. See user edits update the property and a C# assignment update the field.

## Recipes

- [Scope CSS to an HTML component in C#](https://recursiveai.org/oneui/cookbook/scope-css-to-component/index.md): Put a CSS file next to a OneUI HTML template to keep selectors local. Run a C# example that checks the rule against two elements with the same class.
- [Focus an input after a C# component updates](https://recursiveai.org/oneui/cookbook/focus-input-after-component-update/index.md): Set keyboard focus when a OneUI update adds a search input. Bind an ElementRef in HTML and call Focus from the C# component’s OnMounted callback.
- [Render inline SVG in a C# UI component](https://recursiveai.org/oneui/cookbook/render-inline-svg-in-component/index.md): Put an SVG shape in a OneUI HTML template, bind its fill to C# state, and run a console example that checks the SVG namespace and updated fill.
- [Build a C# UI component without HTML](https://recursiveai.org/oneui/cookbook/build-ui-component-without-markup/index.md): Build a OneUI button and update its label in pure C#. The example uses Component, Scope and SetState without an HTML template or generated bindings.
- [Pass HTML into named component slots in C#](https://recursiveai.org/oneui/cookbook/pass-html-content-to-component-slots/index.md): Define a named slot with fallback HTML in OneUI. Fill it from a parent template, leave it empty in another instance, and update the parent’s bound title.
