terra-form
Version:
Components for building forms
16 lines • 1.5 kB
Markdown
## SelectField Props Table
| Prop Name | Type | Is Required | Default Value | Description |
|-|-|-|-|-|
| choices| `array`| optional| `null`| List of choices to be selected. If choices and options array are supplied, options array will be used over choices.|
| defaultValue| `string`| optional| `undefined`| The value to start the select on.|
| error| `node`| optional| `null`| Error message for when the input is invalid.|
| help| `node`| optional| `null`| Help element to display with the input.|
| isInline| `bool`| optional| `false`| Whether the field is inline.|
| label| `node`| optional| `null`| Label of the input.|
| labelAttrs| `object`| optional| `{}`| Attributes to attach to the label.|
| name| `string`| optional| `null`| Name of the select field.|
| onChange| `func`| optional| `undefined`| Function to trigger when the user changes the select value. Provide a function to create a controlled input.|
| options| `array of objects structured like: {"value":{"name":"string","required":true},"display":{"name":"string","required":true}}`| optional| `null`| List of object key and value pairs for choices to be selected. If choices and options array are supplied, options array will be used over choices.|
| required| `bool`| optional| `false`| Whether the select is required or not.|
| selectAttrs| `object`| optional| `{}`| Custom attributes to apply to the select.|
| value| `string`| optional| `undefined`| The value of the select element. Use this to create a controlled input.|