diff --git a/.changeset/real-falcons-care.md b/.changeset/real-falcons-care.md
new file mode 100644
index 0000000000..f989a4e360
--- /dev/null
+++ b/.changeset/real-falcons-care.md
@@ -0,0 +1,5 @@
+---
+"@nextui-org/user": patch
+---
+
+removed `name` from `avatarProps` in `use-user.ts` (#3369)
diff --git a/packages/components/user/__tests__/user.test.tsx b/packages/components/user/__tests__/user.test.tsx
index 702fa0404f..932fcbb523 100644
--- a/packages/components/user/__tests__/user.test.tsx
+++ b/packages/components/user/__tests__/user.test.tsx
@@ -3,6 +3,7 @@ import {render} from "@testing-library/react";
import {Link} from "@nextui-org/link";
import {User} from "../src";
+import {AvatarIcon} from "../../avatar/src";
describe("User", () => {
it("should render correctly", () => {
@@ -20,9 +21,11 @@ describe("User", () => {
it("should have the passed name", () => {
const {container} = render();
- const name = container.querySelector("span");
+ const spans = container.querySelectorAll("span");
- expect(name).toHaveTextContent("Test");
+ expect(spans).toHaveLength(4);
+
+ expect(spans[2]).toHaveTextContent("Test");
});
it("should have the passed description", () => {
@@ -72,4 +75,31 @@ describe("User", () => {
expect(wrapper.getByTestId("test-user-link")).toBeInTheDocument();
});
+
+ it("should render avatar icon", () => {
+ const {container} = render(
+ ,
+ }}
+ name="test"
+ />,
+ );
+
+ expect(container.querySelector("svg")).toBeInTheDocument();
+ });
+
+ it("should display initials in avatar if name is specified", () => {
+ const {getByRole} = render(
+ ,
+ name: "WK",
+ }}
+ name="test"
+ />,
+ );
+
+ expect(getByRole("img")).toHaveTextContent("WK");
+ });
});
diff --git a/packages/components/user/src/use-user.ts b/packages/components/user/src/use-user.ts
index 2d481e7686..a7782aece7 100644
--- a/packages/components/user/src/use-user.ts
+++ b/packages/components/user/src/use-user.ts
@@ -66,7 +66,6 @@ export function useUser(props: UseUserProps) {
const avatarProps = {
isFocusable: false,
- name: typeof name === "string" ? name : undefined,
...userAvatarProps,
};