File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
installer/templates/phx_web/components Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -140,8 +140,22 @@ defmodule <%= @web_namespace %>.CoreComponents do
140140
141141 ## Examples
142142
143- <.input field={@form[:email]} type="email" />
144- <.input name="my-input" errors={["oh no!"]} />
143+ ```heex
144+ <.input field={@form[:email]} type="email" />
145+ <.input name="my-input" errors={["oh no!"]} />
146+ ```
147+
148+ ## Select type
149+
150+ When using `type="select"`, you must pass the `options` and optionally
151+ a `value` to mark which option should be preselected.
152+
153+ ```heex
154+ <.input field={@form[:user_type]} type="select" options={["Admin": "admin", "User": "user"]} />
155+ ```
156+
157+ For more information on what kind of data can be passed to `options` see
158+ [`options_for_select`](https://hexdocs.pm/phoenix_html/Phoenix.HTML.Form.html#options_for_select/2).
145159 """
146160 attr :id , :any , default: nil
147161 attr :name , :any
You can’t perform that action at this time.
0 commit comments