diff --git a/packages/anastasis-webui/src/components/fields/TextInput.tsx b/packages/anastasis-webui/src/components/fields/TextInput.tsx index efa95d84e..55643b4a1 100644 --- a/packages/anastasis-webui/src/components/fields/TextInput.tsx +++ b/packages/anastasis-webui/src/components/fields/TextInput.tsx @@ -2,6 +2,7 @@ import { h, VNode } from "preact"; import { useLayoutEffect, useRef, useState } from "preact/hooks"; export interface TextInputProps { + inputType?: "text" | "number" | "multiline" | "password"; label: string; grabFocus?: boolean; disabled?: boolean; @@ -12,13 +13,22 @@ export interface TextInputProps { bind: [string, (x: string) => void]; } -export function TextInput(props: TextInputProps): VNode { +const TextInputType = function ({ inputType, grabFocus, ...rest }: any): VNode { const inputRef = useRef(null); useLayoutEffect(() => { - if (props.grabFocus) { + if (grabFocus) { inputRef.current?.focus(); } - }, [props.grabFocus]); + }, [grabFocus]); + + return inputType === "multiline" ? ( +