diff --git a/apps/dokploy/components/dashboard/application/advanced/ports/update-port.tsx b/apps/dokploy/components/dashboard/application/advanced/ports/update-port.tsx
index a068ce18c..0ed9d2e27 100644
--- a/apps/dokploy/components/dashboard/application/advanced/ports/update-port.tsx
+++ b/apps/dokploy/components/dashboard/application/advanced/ports/update-port.tsx
@@ -17,7 +17,7 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
-import { Input } from "@/components/ui/input";
+import { Input, NumberInput } from "@/components/ui/input";
import {
Select,
SelectContent,
@@ -125,28 +125,14 @@ export const UpdatePort = ({ portId }: Props) => {
Published Port
- {
- const value = e.target.value;
- if (value === "") {
- field.onChange(0);
- } else {
- const number = Number.parseInt(value, 10);
- if (!Number.isNaN(number)) {
- field.onChange(number);
- }
- }
- }}
- />
+
)}
/>
+
{
Target Port
- {
- const value = e.target.value;
- if (value === "") {
- field.onChange(0);
- } else {
- const number = Number.parseInt(value, 10);
- if (!Number.isNaN(number)) {
- field.onChange(number);
- }
- }
- }}
- />
+
diff --git a/apps/dokploy/components/dashboard/application/domains/add-domain.tsx b/apps/dokploy/components/dashboard/application/domains/add-domain.tsx
index 7ab67a29d..4b5d4e09b 100644
--- a/apps/dokploy/components/dashboard/application/domains/add-domain.tsx
+++ b/apps/dokploy/components/dashboard/application/domains/add-domain.tsx
@@ -18,7 +18,7 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
-import { Input } from "@/components/ui/input";
+import { Input, NumberInput } from "@/components/ui/input";
import {
Select,
SelectContent,
@@ -228,13 +228,7 @@ export const AddDomain = ({
Container Port
- {
- field.onChange(Number.parseInt(e.target.value));
- }}
- />
+
diff --git a/apps/dokploy/components/dashboard/compose/domains/add-domain.tsx b/apps/dokploy/components/dashboard/compose/domains/add-domain.tsx
index 91f211d14..9f586467b 100644
--- a/apps/dokploy/components/dashboard/compose/domains/add-domain.tsx
+++ b/apps/dokploy/components/dashboard/compose/domains/add-domain.tsx
@@ -18,7 +18,7 @@ import {
FormLabel,
FormMessage,
} from "@/components/ui/form";
-import { Input } from "@/components/ui/input";
+import { Input, NumberInput } from "@/components/ui/input";
import {
Select,
SelectContent,
@@ -364,13 +364,7 @@ export const AddDomainCompose = ({
Container Port
- {
- field.onChange(Number.parseInt(e.target.value));
- }}
- />
+
diff --git a/apps/dokploy/components/ui/input.tsx b/apps/dokploy/components/ui/input.tsx
index 55b46e6de..8fe7ab282 100644
--- a/apps/dokploy/components/ui/input.tsx
+++ b/apps/dokploy/components/ui/input.tsx
@@ -31,4 +31,39 @@ const Input = React.forwardRef(
);
Input.displayName = "Input";
-export { Input };
+const NumberInput = React.forwardRef(
+ ({ className, errorMessage, ...props }, ref) => {
+ return (
+ {
+ const value = e.target.value;
+ if (value === "") {
+ props.onChange?.(e);
+ } else {
+ const number = Number.parseInt(value, 10);
+ if (!Number.isNaN(number)) {
+ const syntheticEvent = {
+ ...e,
+ target: {
+ ...e.target,
+ value: number,
+ },
+ };
+ props.onChange?.(
+ syntheticEvent as unknown as React.ChangeEvent,
+ );
+ }
+ }
+ }}
+ />
+ );
+ },
+);
+NumberInput.displayName = "NumberInput";
+
+export { Input, NumberInput };