MCPcopy Create free account
hub / github.com/formkit/formkit / selectInput

Function selectInput

packages/inputs/src/features/selects.ts:79–87  ·  view source on GitHub ↗

* Select the correct values. * @param e - The input event emitted by the select.

(node: FormKitNode, e: Event)

Source from the content-addressed store, hash-verified

77 * @param e - The input event emitted by the select.
78 */
79function selectInput(node: FormKitNode, e: Event) {
80 const target = e.target as HTMLSelectElement
81 const value = target.hasAttribute('multiple')
82 ? Array.from(target.selectedOptions).map((o) =>
83 optionValue(node.props.options, o.value)
84 )
85 : optionValue(node.props.options, target.value)
86 node.input(value)
87}
88
89/**
90 * Appends a placeholder to the options list.

Callers 1

select.tsFile · 0.85

Calls 1

optionValueFunction · 0.90

Tested by

no test coverage detected