davila7/claude-code-templates / cli-tool/components/skills/development/avalonia-layout-zafiro
avalonia-layout-zafiro
VerifiedGuidelines for modern Avalonia UI layout using Zafiro.Avalonia, emphasizing shared styles, generic components, and avoiding XAML redundancy.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.3 KB |
| behaviors.md | markdown | 1.4 KB |
| components.md | markdown | 1.4 KB |
| containers.md | markdown | 1.5 KB |
| icons.md | markdown | 1.7 KB |
| themes.md | markdown | 1.8 KB |
components.md
View on GitHub# Building Generic Components
Reducing nesting and complexity is achieved by breaking down views into generic, reusable components.
## 🧊 Generic Components
Instead of building large, complex views, extract recurring patterns into small `UserControl`s.
### Example: A generic "Summary Item"
Instead of repeating a `Grid` with labels and values:
```xml
<!-- ❌ BAD: Repeated Grid -->
<Grid ColumnDefinitions="*,Auto">
<TextBlock Text="Total:" />
<TextBlock Grid.Column="1" Text="{Binding Total}" />
</Grid>
```
Create a generic component (or use `EdgePanel` with a Style):
```xml
<!-- ✅ GOOD: Use a specialized control or style -->
<EdgePanel StartContent="Total:" EndContent="{Binding Total}" Classes="SummaryItem" />
```
## 📉 Flattening Layouts
Avoid deep nesting. Deeply nested XAML is hard to read and can impact performance.
- **StackPanel vs Grid**: Use `StackPanel` (with `Spacing`) for simple linear layouts.
- **EdgePanel**: Great for "Label - Value" or "Icon - Text - Action" rows.
- **UniformGrid**: Use for grids where all cells are the same size.
## 🔧 Component Granularity
- **Atomical**: Small controls like custom buttons or icons.
- **Molecular**: Groups of atoms like a `HeaderedContainer` with specific content.
- **Organisms**: Higher-level sections of a page.
Aim for components that are generic enough to be reused but specific enough to simplify the parent view significantly.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |