diff --git a/.changeset/selfish-kings-clap.md b/.changeset/selfish-kings-clap.md
new file mode 100644
index 0000000000..92e9ab27bd
--- /dev/null
+++ b/.changeset/selfish-kings-clap.md
@@ -0,0 +1,6 @@
+---
+"@heroui/date-input": patch
+"@heroui/theme": patch
+---
+
+add 'outside-top' prop to input
diff --git a/apps/docs/content/components/input/label-placements.raw.jsx b/apps/docs/content/components/input/label-placements.raw.jsx
index 428dc662bb..29be3df06c 100644
--- a/apps/docs/content/components/input/label-placements.raw.jsx
+++ b/apps/docs/content/components/input/label-placements.raw.jsx
@@ -1,7 +1,7 @@
import {Input} from "@heroui/react";
export default function App() {
- const placements = ["inside", "outside", "outside-left"];
+ const placements = ["inside", "outside", "outside-left", "outside-top"];
return (
diff --git a/apps/docs/content/docs/components/input.mdx b/apps/docs/content/docs/components/input.mdx
index d11c705446..751f4f9234 100644
--- a/apps/docs/content/docs/components/input.mdx
+++ b/apps/docs/content/docs/components/input.mdx
@@ -75,12 +75,16 @@ the end of the label and the input will be required.
### Label Placements
-You can change the position of the label by setting the `labelPlacement` property to `inside`, `outside` or `outside-left`.
+You can change the position of the label by setting the `labelPlacement` property to `inside`, `outside`, `outside-left` or `outside-top`.
> **Note**: If the `label` is not passed, the `labelPlacement` property will be `outside` by default.
+> **Note**: If the `labelPlacement` is `outside`, `label` is outside only when a placeholder is provided.
+
+> **Note**: If the `labelPlacement` is `outside-top` or `outside-left`, `label` is outside even if a placeholder is not provided.
+
### Password Input
You can use the `type` property to change the input type to `password`.
diff --git a/packages/components/input/src/input.tsx b/packages/components/input/src/input.tsx
index d6d646dfd5..718cbad622 100644
--- a/packages/components/input/src/input.tsx
+++ b/packages/components/input/src/input.tsx
@@ -17,6 +17,7 @@ const Input = forwardRef<"input", InputProps>((props, ref) => {
labelPlacement,
hasHelper,
isOutsideLeft,
+ isOutsideTop,
shouldLabelBeOutside,
errorMessage,
isInvalid,
@@ -82,7 +83,7 @@ const Input = forwardRef<"input", InputProps>((props, ref) => {
return (
- {!isOutsideLeft ? labelContent : null}
+ {!isOutsideLeft && !isOutsideTop ? labelContent : null}
{innerWrapper}
{helperWrapper}
@@ -115,7 +116,7 @@ const Input = forwardRef<"input", InputProps>((props, ref) => {
return (
- {isOutsideLeft ? labelContent : null}
+ {isOutsideLeft || isOutsideTop ? labelContent : null}
{mainWrapper}
);
diff --git a/packages/components/input/src/use-input.ts b/packages/components/input/src/use-input.ts
index 96ec39906b..33c693fe78 100644
--- a/packages/components/input/src/use-input.ts
+++ b/packages/components/input/src/use-input.ts
@@ -1,13 +1,7 @@
import type {InputVariantProps, SlotsToClasses, InputSlots} from "@heroui/theme";
import type {AriaTextFieldOptions} from "@react-aria/textfield";
-import {
- HTMLHeroUIProps,
- mapPropsVariants,
- PropGetter,
- useLabelPlacement,
- useProviderContext,
-} from "@heroui/system";
+import {HTMLHeroUIProps, mapPropsVariants, PropGetter, useProviderContext} from "@heroui/system";
import {useSafeLayoutEffect} from "@heroui/use-safe-layout-effect";
import {AriaTextFieldProps} from "@react-types/textfield";
import {useFocusRing} from "@react-aria/focus";
@@ -233,10 +227,14 @@ export function useInput
(() => {
+ if ((!originalProps.labelPlacement || originalProps.labelPlacement === "inside") && !label) {
+ return "outside";
+ }
+
+ return originalProps.labelPlacement ?? "inside";
+ }, [originalProps.labelPlacement, label]);
const errorMessage =
typeof props.errorMessage === "function"
@@ -247,17 +245,26 @@ export function useInput (
Without placeholder
-
diff --git a/packages/core/theme/src/components/input.ts b/packages/core/theme/src/components/input.ts
index 17f5f1fec7..daabfedf06 100644
--- a/packages/core/theme/src/components/input.ts
+++ b/packages/core/theme/src/components/input.ts
@@ -178,6 +178,10 @@ const input = tv({
mainWrapper: "flex flex-col",
label: "relative text-foreground pe-2 ps-2 pointer-events-auto",
},
+ "outside-top": {
+ mainWrapper: "flex flex-col",
+ label: "relative text-foreground pb-2 pointer-events-auto",
+ },
inside: {
label: "cursor-text",
inputWrapper: "flex-col items-start justify-center gap-0",