Skip to content

Commit 7a261f9

Browse files
committed
chore: allow-custom-ref-passing-to-bignumberfield
1 parent dde7171 commit 7a261f9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib/form/bignumber-field/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ interface BigNumberFieldComponentProps extends BigNumberFieldProps {
1717
className?: string;
1818
/** The name of the input element, used when submitting an HTML form.*/
1919
name?: string;
20+
inputRef?: React.Ref<HTMLInputElement>;
21+
buttonRef?: React.Ref<HTMLButtonElement>;
2022
}
2123

2224
/** A number field that handles big numbers.
@@ -31,6 +33,8 @@ function BigNumberField({
3133
isDisabled,
3234
isReadOnly,
3335
name,
36+
inputRef,
37+
buttonRef,
3438
...props
3539
}: Readonly<BigNumberFieldComponentProps>) {
3640
// Use our custom hook to get all the props and state
@@ -44,7 +48,6 @@ function BigNumberField({
4448
errorMessageProps,
4549
validationResult,
4650
} = useBigNumberField({ isDisabled, placeholder, isReadOnly, ...props });
47-
4851
return (
4952
<div className={cn("flex w-[278px] flex-col", className)}>
5053
{label && (
@@ -64,6 +67,7 @@ function BigNumberField({
6467
<>
6568
<Input
6669
{...inputProps}
70+
ref={inputRef}
6771
aria-errormessage={`BigNumberFieldError-${inputProps.id}`}
6872
name={name}
6973
className={cn(
@@ -98,6 +102,7 @@ function BigNumberField({
98102
>
99103
<Button
100104
{...incrementButtonProps}
105+
ref={buttonRef}
101106
excludeFromTabOrder
102107
className={clsx(
103108
"rounded-base hover:bg-klerosUIComponentsStroke size-3.5 cursor-pointer border-none bg-transparent",

0 commit comments

Comments
 (0)