← ClaudeAtlas

nette-componentslisted

Invoke before writing or modifying a Nette component (Control), a component factory or a signal handler, and before any AJAX/snippet code. Use when working with createComponent<Name>(), $this['name'], handle<Signal>() methods, signal links (n:href="click!", link('click')), {plink} in a component template, persistent parameters (#[Persistent]) and persistent components, redrawControl()/isControlInvalid(), {snippet} and {snippetArea}, dynamic snippets, isAjax() and $this->payload, Multiplier, or the component tree (getComponents(), getComponentTree(), monitor(), lookup(), $onAnchor). Also trigger for "snippet is not redrawing", BadSignalException, or "how do I do AJAX in Nette".
nette/agent-plugins · ★ 44 · AI & Automation · score 81
Install: claude install-skill nette/agent-plugins
## Nette Components, Signals and Snippets A component is a descendant of `Nette\Application\UI\Control`, and the presenter is itself a `Control` (`ComponentModel\Component` -> `Container` -> `UI\Component` -> `UI\Control` -> `UI\Presenter`), so everything below applies to both. Related skills: **nette-forms** (controls, validation, `onSuccess`), **nette-architecture** (where components live), **latte-templates** (`{control}`/`{snippet}` syntax), **nette-configuration** (generated factories), **frontend-development** (Naja on the JS side). ### Component Factories Any container (presenter or control) creates children lazily through `createComponent<Name>()`: ```php protected function createComponentPoll(): PollControl { return new PollControl($this->items); } ``` The factory is never called directly. It fires on first access – `$this->getComponent('poll')` or the equivalent `$this['poll']` (the `ComponentModel\ArrayAccess` trait), which is what `{control poll}` does. An untouched component is never built. - **The name starts with a lowercase letter.** `Container::createComponent()` requires `ucfirst($name) !== $name`, so asking for `Poll` never reaches `createComponentPoll()`. - The factory receives the name as its first argument, and may either return the component or add it itself with `addComponent()`; doing neither throws `Nette\UnexpectedValueException`. - Names match `#^[a-zA-Z0-9_]+$#D` – **no hyphen in a name**, `-` is the tree separator: `$this['cart-form'