I’m working on a plugin that need some modal dialog, both Ember component and Discourse widget may implement it i konw after search on meta. The Ember component and Discourse widget both can be attach to plugin outlet, render html, handle event.
I can only find one topic about widget above, it just said Discourse widget can render faster. But i found the Discourse core and much other plugins they both using Ember component and Discourse widget. For example:
Components are broadly used across most of Discourse. Where widgets come in useful is on some of our most highly-trafficked elements, such as the topic post stream and the header with its multiple menus.
You’ll often see widgets used in plugins and themes to add to or modify existing widgets.
Take for example this widget in the discourse-calendar plugin:
This is a button rendered in the original post of a topic. It needs to be a widget because the post itself is rendered as a widget for performance reasons.
So generally, you can use components unless the UI element is already rendered as a widget. In that case use a widget. And if it makes sense, you can utilize existing components inside the widget.
if you are displaying a lot of it, you probably want to choose widgets for perf
widgets are more limited than components, and require more knowledge to get something working perfectly when building complex UI
So basically if perf is not a question and I can use it, I will prefer components. If perf is a question or if Im forced to (eg: using the plugin api to decorate another widget), I will probably use widgets.