VikWeb.CoreComponents (Vik v0.0.1-rc2)
View SourceProvides core UI components.
Summary
Functions
Renders a button.
Examples
<.button>Send!</.button>
<.button phx-click="go" class="action-button">Send!</.button>Attributes
type(:string) - Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["disabled", "form", "name", "value"].
Slots
inner_block(required)
Generates a generic error message.
Slots
inner_block(required)
Renders flash notices.
Examples
<.flash kind={:info} flash={@flash} />
<.flash kind={:info} phx-mounted={show("#flash")}>Welcome Back!</.flash>Attributes
id(:string) - the optional id of flash container.flash(:map) - the map of flash messages to display. Defaults to%{}.title(:string) - Defaults tonil.kind(:atom) - used for styling and flash lookup. Must be one of:info, or:error.- Global attributes are accepted. the arbitrary HTML attributes to add to the flash container.
Slots
inner_block- the optional inner block that renders the flash message.
Shows the flash group with standard titles and content.
Examples
<.flash_group flash={@flash} />Attributes
flash(:map) (required) - the map of flash messages.id(:string) - the optional id of flash container. Defaults to"flash-group".
Same as Phoenix.LiveView.JS.hide/2.
Left here for backwards compatibility.
Renders a Heroicon.
Heroicons come in three styles – outline, solid, and mini.
By default, the outline style is used, but solid and mini may
be applied by using the -solid and -mini suffix.
Examples
<.icon name="hero-x-mark-solid" />
<.icon name="hero-arrow-path" />Attributes
name(:string) (required)class(:string) - Defaults tonil.
Renders an input with label and error messages.
A Phoenix.HTML.FormField may be passed as argument,
which is used to retrieve the input name, id, and values.
Otherwise all attributes may be passed explicitly.
Examples
<.input field={@form[:email]} type="email" />
<.input name="my-input" errors={["oh no!"]} />Attributes
id(:any) - Defaults tonil.name(:any)label(:string) - Defaults tonil.value(:any)type(:string) - Defaults to"text". Must be one of"text", or"hidden".field(Phoenix.HTML.FormField) - a form field struct retrieved from the form, for example: @form[:email].errors(:list) - Defaults to[].- Global attributes are accepted. Supports all globals plus:
["accept", "autocomplete", "capture", "cols", "disabled", "form", "list", "max", "maxlength", "min", "minlength", "multiple", "pattern", "placeholder", "readonly", "required", "rows", "size", "step"].
Renders a label.
Attributes
for(:string) - Defaults tonil.
Slots
inner_block(required)
Same as Phoenix.LiveView.JS.show/2.
Left here for backwards compatibility.