Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{twbs-form-group}} Enhancements #16

Open
nadnoslen opened this issue Aug 16, 2017 · 0 comments
Open

{{twbs-form-group}} Enhancements #16

nadnoslen opened this issue Aug 16, 2017 · 0 comments

Comments

@nadnoslen
Copy link
Member

Using block params to the {{twbs-form-group}} component can open some very pleasant possibilities. For example we can provide basic label, text/textarea inputs, help blocks and of course the errors block that we already support.

Here is an example of creating a full form group for a text input:

{{#twbs-form-group fieldErrors=model.errors.fieldName as | fg |}}
  {{#fg.label for="js-theInput"}}The Input Label{{/fg.label}}
  {{fg.input-text placeholder="The Input Placeholder" title="The Input Title" type="number" value=model.fieldName}}
  {{#fg.help-block}}The input help block.{{/fg.help-block}}
{{/twbs-form-group}}

Here is an example of creating a full form group for a auto-sizing text area:

{{#twbs-form-group fieldErrors=model.errors.fieldName as | fg |}}
  {{#fg.label for="js-theInput"}}The Input Label{{/fg.label}}
  {{fg.text-area placeholder="The Input Placeholder" title="The Input Title" value=model.fieldName}}
  {{#fg.help-block}}The input help block.{{/fg.help-block}}
{{/twbs-form-group}}

Here is an example of creating a full form group for a markdown text-area with a preview toggle

{{#twbs-form-group fieldErrors=model.errors.fieldName as | fg |}}
  {{#fg.label-md for="js-theInput"}}The Input Label{{/fg.label}}
  {{fg.text-area-md placeholder="The Input Placeholder" title="The Input Title" value=model.fieldName}}
  {{#fg.help-block}}The input help block.{{/fg.help-block}}
{{/twbs-form-group}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant