consul/ui/packages/consul-ui/app/components/option-input
hashicorp-copywrite[bot] 5fb9df1640
[COMPLIANCE] License changes (#18443)
* Adding explicit MPL license for sub-package

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-11 09:12:13 -04:00
..
README.mdx
index.hbs [COMPLIANCE] License changes (#18443) 2023-08-11 09:12:13 -04:00

README.mdx

# OptionInput

Form component to be used for choosing options, both compacted form (coming
soon) and expanded form. Certain API decision are based on the usage of
`ember-power-select` which is currently used internally. This is likely to
change slightly at some point in the future.

```hbs preview-template
  <OptionInput
    @name="Choice"
    @label="Choice of different options"
    @item={{hash
      Choice="selection"
    }}
    @selected={{or this.selected 'option 2'}}
    @items={{array
      'option 1'
      'option 2'
      'option 3'
      'option 4'
    }}
    @onchange={{action (mut this.selected)}}
  >
    <:option as |option|>
      <span>{{option.item}}</span>
    </:option>
  </OptionInput>
```

## Arguments

| Argument | Type | Default | Description |
| --- | --- | --- | --- |
| `item` | `Object` |  | An object whose properties are to be edited |
| `name` | `String` | '' | An identifier for the property to be edited on the `item` |
| `label` | `String` | `@name` | A label to use to label the text input element |
| `placeholder` | `String` | | Equivalent to the HTML `placeholder=""` attribute |
| `help` | `String` | | Provide some help text for the input (consider using `@validations` instead) |
| `multiple` | `Boolean` | `false` | Set the OptionInput to be multiple choice (coming soon) |
| `expanded` | `Boolean` | `false` | Whether to use expanded radiobuttons/checkboxes or just a non-expanded select-like input |
| `validations` | `Object` |  | A `validations` object to be passed to the underlying `validate` modifier |
| `chart` | `Object` | | A StateChart object (implementing `state` and `dispatch` to be passed to the underlying `validate` modifier  |
| `onchange` | `Function` | | An event listener fired onchange of the input |

## See

- [Validate Modifier](../modifiers/validate.mdx)
- [Template Source Code](./index.hbs)

---