Radio button lists: view or component?


#1

Ember uses Views for Select components because of the natural collection looping inherit to Views, whereas singular elements like input[type=“text”] are typically components.

Technically both are possible. Although caveat - radio button lists require 2 components - 1 for radio-button, 2 for radio-button-list.

View:

{{view "radio-list"
	value=customerSatisfaction
	content=customerSatisfactionValues
	optionValuePath="content.value"
	optionLabelPath="content.label"}}

Or component:

{{#radio-list label="Component Customer Sat" value=customerSatisfaction}}
	{{radio-list-input name="custSat" label="Label High" value="high"}}
	{{radio-list-input name="custSat" label="Label Med" value="med"}}
	{{radio-list-input name="custSat" label="Label Low" value="low"}}
{{/radio-list}}

Or is a View a Component and the point is irrelevant?


#2

I think Ember uses views for Selects because of legacy reasons; there was even talk about deprecating it in favor of turning it into a component not so long ago.


#3

gahhhhh… #facepalm


#4

Technically, a Component is a sub-class of View, but that’s only an implementation detail. It’s recommended to simply use Components instead of Views for everything and anything.


#5

Sounds reasonable. Thanks @ulisesrmzroche