From 06c20fa95073b95e02e1ceb8dec5faf646df5b9b Mon Sep 17 00:00:00 2001 From: Tilen Komel Date: Fri, 23 Aug 2024 18:09:16 +0200 Subject: [PATCH] Add dynamic value to input --- src/components/Form/FormInput.tsx | 1 + src/components/UI/Input.tsx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Form/FormInput.tsx b/src/components/Form/FormInput.tsx index fced1b00..33ba8ccd 100644 --- a/src/components/Form/FormInput.tsx +++ b/src/components/Form/FormInput.tsx @@ -9,6 +9,7 @@ import { Controller, type FieldValues } from "react-hook-form"; export interface InputFieldProps extends BaseFormBuilderProps { type: "text" | "number" | "password"; properties?: { + value?: string; prefix?: string; suffix?: string; step?: number; diff --git a/src/components/UI/Input.tsx b/src/components/UI/Input.tsx index 2c3080fb..630a6364 100644 --- a/src/components/UI/Input.tsx +++ b/src/components/UI/Input.tsx @@ -31,7 +31,7 @@ export interface InputProps } const Input = React.forwardRef( - ({ className, variant, prefix, suffix, action, ...props }, ref) => { + ({ className, value, variant, prefix, suffix, action, ...props }, ref) => { return (
{prefix && ( @@ -45,6 +45,7 @@ const Input = React.forwardRef( className, inputVariants({ variant }), )} + value={value} ref={ref} {...props} />