# Component Override Pattern

`rustelo_components` provides the full set of generic UI components used by any Rustelo implementation. Components are organized by domain:

- `auth` — LoginModal, OTP flow
- `cookie` — CookieBanner, CookieManageModal
- `navigation` — NavMenu, Footer, LanguageSelector, PreNavMenu, PreFooter
- `content` — ContentManager, HtmlContent, ContentCard, ContentGrid
- `theme` — ThemeProvider, ThemeContext
- `ui` — SpaLink, MobileMenu, PageTransition

## Overriding a component in your implementation

When a generic component does not fit your site's requirements, create a local replacement in your implementation crate and register it instead. The override lives entirely in your codebase — `rustelo_components` is not modified.

### Pattern

```
your-impl/crates/pages/src/components/nav_menu.rs   ← your override
your-impl/crates/client/src/app.rs                  ← uses your version
```

```rust
// your override
#[component]
pub fn NavMenu() -> impl IntoView {
    // site-specific implementation
}
```

```rust
// app.rs — use your version instead of the generic one
use crate::components::nav_menu::NavMenu;
```

No indirection crate needed. If you use the generic component as-is, import directly from `rustelo_components`.

## When to create an override crate

Only if multiple crates in your workspace share the same overridden component. In that case, a local `components` crate with `pub use rustelo_components::X` for unmodified components and your custom types for the rest is the right structure.
