open-consul/ui/packages/consul-ui/app/components/form-input/index.hbs

31 lines
672 B
Handlebars
Raw Normal View History

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: MPL-2.0
}}
<label
class={{concat 'form-input' (if (get @chart.state.context.errors @name) ' has-error')}}
...attributes
>
<span>
{{yield to='label'}}
</span>
{{yield to='input'}}
{{#let
(or @validations.help @help)
as |help|}}
{{#if help}}
{{!- add an optional slot here called <:help>?-}}
<em>
{{help}}
</em>
{{/if}}
{{/let}}
<State @state={{@chart.state}} @matches="error">
{{!- add an optional slot here called <:alert/error/success>?-}}
<strong
role="alert"
>{{get (get @chart.state.context.errors @name) 'message'}}</strong>
</State>
</label>