diff options
Diffstat (limited to 'packages/anastasis-webui/src/components/fields/TextInput.tsx')
-rw-r--r-- | packages/anastasis-webui/src/components/fields/TextInput.tsx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/anastasis-webui/src/components/fields/TextInput.tsx b/packages/anastasis-webui/src/components/fields/TextInput.tsx index 4f417730c..efa95d84e 100644 --- a/packages/anastasis-webui/src/components/fields/TextInput.tsx +++ b/packages/anastasis-webui/src/components/fields/TextInput.tsx @@ -8,6 +8,7 @@ export interface TextInputProps { error?: string; placeholder?: string; tooltip?: string; + onConfirm?: () => void; bind: [string, (x: string) => void]; } @@ -37,6 +38,11 @@ export function TextInput(props: TextInputProps): VNode { disabled={props.disabled} placeholder={props.placeholder} class={showError ? "input is-danger" : "input"} + onKeyPress={(e) => { + if (e.key === 'Enter' && props.onConfirm) { + props.onConfirm() + } + }} onInput={(e) => { setDirty(true); props.bind[1]((e.target as HTMLInputElement).value); |