Hyva component recipe — block, view-model, or both?
Categories:
Claude — Recipes Cookbook
Both, always. Hyva enforces the ViewModelInterface pattern hard: blocks are dumb (just getViewModel()), view-models hold the logic. Recipe prompt: "Generate Block/<Name>.php extending Magento\Framework\View\Element\Template, a ViewModel/<Name>.php implementing ArgumentInterface, the view/frontend/layout/<handle>.xml wiring the view-model as a argument, and the view/frontend/templates/<name>.phtml using Tailwind classes only — no Luma, no inline style." Verify: bin/magento cache:flush, load the page, view source, confirm zero data-mage-init attributes (that would be a Luma leak).
Was this helpful?