From 9e8beababea60dc499cc0989a0720fe25a10a823 Mon Sep 17 00:00:00 2001 From: Tianen Pang <32772271+tianenpang@users.noreply.github.com> Date: Thu, 21 Nov 2024 04:33:00 +0800 Subject: [PATCH] fix: label placement when the select has a placeholder or description (#4126) --- .changeset/tough-brooms-hunt.md | 5 +++ .../select/__tests__/select.test.tsx | 3 +- packages/components/select/src/use-select.ts | 3 +- .../select/stories/select.stories.tsx | 37 +++++++++++++++++++ 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 .changeset/tough-brooms-hunt.md diff --git a/.changeset/tough-brooms-hunt.md b/.changeset/tough-brooms-hunt.md new file mode 100644 index 0000000000..3fc6077312 --- /dev/null +++ b/.changeset/tough-brooms-hunt.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/select": patch +--- + +Fix the label placement when the `Select` has a `placeholder` or `description`. diff --git a/packages/components/select/__tests__/select.test.tsx b/packages/components/select/__tests__/select.test.tsx index 6776344eeb..655b06ce81 100644 --- a/packages/components/select/__tests__/select.test.tsx +++ b/packages/components/select/__tests__/select.test.tsx @@ -723,11 +723,12 @@ describe("Select", () => { expect(onChange).toHaveBeenCalledTimes(1); }); - it("should place the label outside when labelPlacement is outside", () => { + it("should place the label outside when labelPlacement is outside and isMultiline enabled", () => { const labelContent = "Favorite Animal Label"; render( +