mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
fix(input): label placement outside when label is missing (#2028)
This commit is contained in:
parent
088af8b6df
commit
0ba165f0fd
6
.changeset/metal-weeks-vanish.md
Normal file
6
.changeset/metal-weeks-vanish.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@nextui-org/select": patch
|
||||
"@nextui-org/input": patch
|
||||
---
|
||||
|
||||
Fix #1979 labelPlacement is outside when not having a label for input, autocomplete and select components.
|
||||
@ -135,12 +135,9 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
|
||||
const handleClear = useCallback(() => {
|
||||
setInputValue("");
|
||||
|
||||
if (domRef.current) {
|
||||
domRef.current.value = "";
|
||||
domRef.current.focus();
|
||||
}
|
||||
onClear?.();
|
||||
}, [domRef, setInputValue, onClear]);
|
||||
domRef.current?.focus();
|
||||
}, [setInputValue, onClear]);
|
||||
|
||||
const {labelProps, inputProps, descriptionProps, errorMessageProps} = useTextField(
|
||||
{
|
||||
@ -211,9 +208,10 @@ export function useInput<T extends HTMLInputElement | HTMLTextAreaElement = HTML
|
||||
input({
|
||||
...variantProps,
|
||||
isInvalid,
|
||||
labelPlacement,
|
||||
isClearable,
|
||||
}),
|
||||
[...Object.values(variantProps), isInvalid, isClearable, hasStartContent],
|
||||
[...Object.values(variantProps), isInvalid, labelPlacement, isClearable, hasStartContent],
|
||||
);
|
||||
|
||||
const getBaseProps: PropGetter = useCallback(
|
||||
|
||||
@ -280,9 +280,10 @@ export function useSelect<T extends object>(originalProps: UseSelectProps<T>) {
|
||||
select({
|
||||
...variantProps,
|
||||
isInvalid,
|
||||
labelPlacement,
|
||||
className,
|
||||
}),
|
||||
[...Object.values(variantProps), isInvalid, className],
|
||||
[...Object.values(variantProps), isInvalid, labelPlacement, className],
|
||||
);
|
||||
|
||||
// scroll the listbox to the selected item
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user