diff options
Diffstat (limited to 'packages/web-util/src/forms/InputChoiceHorizontal.tsx')
-rw-r--r-- | packages/web-util/src/forms/InputChoiceHorizontal.tsx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/packages/web-util/src/forms/InputChoiceHorizontal.tsx b/packages/web-util/src/forms/InputChoiceHorizontal.tsx index 5c909b5d7..594b1c32e 100644 --- a/packages/web-util/src/forms/InputChoiceHorizontal.tsx +++ b/packages/web-util/src/forms/InputChoiceHorizontal.tsx @@ -1,8 +1,13 @@ import { TranslatedString } from "@gnu-taler/taler-util"; import { Fragment, VNode, h } from "preact"; -import { LabelWithTooltipMaybeRequired, UIFormProps } from "./InputLine.js"; +import { LabelWithTooltipMaybeRequired } from "./InputLine.js"; import { useField } from "./useField.js"; -import { Choice } from "./InputChoiceStacked.js"; +import { UIFormProps } from "./FormProvider.js"; + +export interface Choice<V> { + label: TranslatedString; + value: V; +} export function InputChoiceHorizontal<T extends object, K extends keyof T>( props: { @@ -57,6 +62,8 @@ export function InputChoiceHorizontal<T extends object, K extends keyof T>( return ( <button type="button" + disabled={state.disabled} + label={choice.label} class={clazz} onClick={(e) => { onChange( @@ -64,9 +71,7 @@ export function InputChoiceHorizontal<T extends object, K extends keyof T>( ); }} > - {(!converter - ? (choice.value as string) - : converter?.toStringUI(choice.value)) ?? ""} + {choice.label} </button> ); })} |