No Login Data Private Local Save

Ember.js Component Generator - Online Glimmer Starter

6
0
0
0
Copied to clipboard!
Component Config Glimmer
Class: MyComponent  |  Path: app/components/my-component
📦 Wrapper
🔘 Button
🃏 Card
📝 Form Ctrl
📋 List Item
Bare
template.hbs
component.js
styles.css
test.js
Usage
app/components/my-component.hbs

        

Frequently Asked Questions

What is a Glimmer Component in Ember.js?
Glimmer components are the modern component model introduced in Ember.js Octane (3.x+). They extend @glimmer/component and use native JavaScript classes with decorators like @tracked for reactivity and @action for template actions. Unlike classic Ember.Component, Glimmer components have no two-way binding by default, no tagName wrapping div, and encourage explicit data flow with ...attributes and named arguments.
How do @tracked properties work?
The @tracked decorator (from @glimmer/tracking) marks a property as reactive. When a tracked property changes, Ember's autotracking system automatically re-renders any template that depends on it. This eliminates the need for set() or this.notifyPropertyChange(). Simply assign a new value: this.count = this.count + 1; and the DOM updates automatically.
Glimmer vs Classic Ember Components — what's the difference?
Classic components extend Ember.Component and have implicit wrapper elements, two-way binding via {{mut}}, and require this.set() for property changes. Glimmer components are simpler: no wrapper div (use ...attributes on your root element), one-way data flow by default, native JS getters/setters, and decorator-based reactivity. Glimmer components are the recommended approach for all new Ember apps since version 3.15+.
Can I use TypeScript with Glimmer components?
Yes! Glimmer components work excellently with TypeScript. You can define an interface for your component's args, type your tracked properties, and get full IDE autocompletion. Ember's official TypeScript support (via ember-cli-typescript) includes type definitions for @glimmer/component, @glimmer/tracking, and all Ember APIs. This tool supports generating both .js and .ts files.
How do I pass HTML attributes to my Glimmer component?
Use ...attributes in your component's template on the root element. This splattributes syntax forwards any HTML attributes (like class, id, data-*, aria-*) from the invocation site to the component's DOM element. For example: <MyComponent class="custom" data-test="foo" /> will apply those attributes to the element with ...attributes.
What is the {{yield}} keyword in Ember templates?
{{yield}} renders the block content passed to a component. When you invoke a component with a block: <MyComponent>Hello World</MyComponent>, the "Hello World" content is rendered where {{yield}} appears in the component's template. You can also use named yields with {{yield to="header"}} for multiple content insertion points.
How do I generate components using Ember CLI?
Use the Ember CLI command: ember generate component my-component (or shorthand ember g component my-component). This creates the .hbs template and .js class file automatically. For Glimmer components specifically, ensure you're using Ember 3.15+. Add flags like --typescript for TypeScript or --path for nested components. This online tool provides a visual alternative with instant preview.
Why use an online component generator?
An online generator lets you quickly prototype component structures without installing CLI tools. You can experiment with different configurations (TypeScript/JavaScript, with or without tracked properties, various template presets) and instantly see the generated code. It's perfect for learning Ember.js patterns, teaching, quick scaffolding, or when you're on a device without your full development environment.