# Phoenix & LiveView Rules
## HEEx Template Syntax (Critical)
- **Attributes use `{}`**: `
` — never `<%= %>` in attributes
- **Body values use `{}`**: `{@value}` — use `<%= %>` only for blocks (if/for/cond)
- **Class lists require `[]`**: `class={["base", @flag && "active"]}` — bare `{}` is invalid
- **No `else if`**: Use `cond` for multiple conditions
- **Comments**: `<%!-- comment --%>`
- **Literal curlies**: Use `phx-no-curly-interpolation` on parent tag
## Phoenix v1.8
- Wrap templates with `` (already aliased)
- `current_scope` errors → move routes to proper `live_session`, pass to Layouts.app
- `<.flash_group>` only in layouts.ex
- Use `<.icon name="hero-x-mark">` for icons, `<.input>` for form fields
## LiveView
- Use `<.link navigate={}>` / `push_navigate`, not deprecated `live_redirect`
- Hooks with own DOM need `phx-update="ignore"`
- Avoid LiveComponents unless necessary
- No inline `