Skip to content

Commit e4ba43b

Browse files
authored
fix(components): input label overlapping issue (#2371)
* fix(components): input label overlapping issue * chore(root): add changeset for input overlapping issue
1 parent 995b37e commit e4ba43b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/itchy-shirts-build.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nextui-org/input": patch
3+
---
4+
5+
fixed input label overlapping issue (#2255)

packages/components/input/src/use-input.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
8787
const {
8888
ref,
8989
as,
90+
type,
9091
label,
9192
baseRef,
9293
wrapperRef,
@@ -122,7 +123,8 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
122123

123124
const Component = as || "div";
124125

125-
const isFilled = !!inputValue;
126+
const isFilledByDefault = ["date", "time", "month", "week", "range"].includes(type!);
127+
const isFilled = !!inputValue || isFilledByDefault;
126128
const isFilledWithin = isFilled || isFocusWithin;
127129
const baseStyles = clsx(classNames?.base, className, isFilled ? "is-filled" : "");
128130
const isMultiline = originalProps.isMultiline;

0 commit comments

Comments
 (0)