Select

Defines a select


Provides a wrapper for Phoenix.HTML.Form's select/4 function.

All options passed via opts will be sent to select/4, class can be set directly and will override anything in opts.


      
<div class="select">
  <Select form="user" field="role" options={"Admin": "admin", "User": "user"}/>
</div>
    

Other Select related components

  • MultipleSelect - Provides a wrapper for Phoenix.HTML.Form's multiple_select/4 function.

  • OptionsForSelect - Defines options to be used inside a select.

  • DateTimeSelect - Provides a wrapper for Phoenix.HTML.Form's datetime_select/3 function.

  • TimeSelect - Provides a wrapper for Phoenix.HTML.Form's time_select/3 function.



# Public API

Name Description Type Values Default
id The id of the corresponding select field.

:string
form The form identifier.

:form
field The field name.

:any
name The name of the corresponding select field.

:string
class The CSS class for the underlying tag.

:css_class
options The options in the select.

:any []
prompt An option to include at the top of the options with the given prompt text.

:string
selected The default value to use when none was sent as parameter.

:any
opts Options list.

:keyword []