Is there a way to display the avatar image outside of the drawer in MUI ReactJS?

Currently, I am attempting to display the avatar image with a curved effect outside the border line of the sidebar.

I have referenced the persistent drawer from MUI v5 for inspiration. You can view an example here: the codesandbox link

The desired outcome is illustrated in this image: https://i.stack.imgur.com/ACaXh.jpg

In my current implementation, the drawer's style is configured as follows:

<Drawer
        sx={{
          width: drawerWidth,
          flexShrink: 0,
          //position: "relative",
          "& .MuiDrawer-paper": {
            width: drawerWidth,
            boxSizing: "border-box"
          }
        }}
        variant="persistent"
        anchor="left"
        open={open}
      >

Furthermore, the style applied to the Avatar within the drawer header is outlined below:

<Avatar
  alt="test"
  src="./test.jpg"
  sx={{
    //position: "absolute",
    width: "120px",
    height: "120px",
    marginLeft: "150px"
  }}
/>

I am seeking assistance on how to achieve this specific visual style. Any help would be greatly appreciated.

Answer №1

Implement the following styles

<Drawer
  sx={{
    "& .MuiDrawer-paper": {
      position: "relative",
      overflowY: "visible"
    },
  }}
>
<Avatar
  sx={{
    position: "absolute",
    top: 20,
    right: -60,
  }}
/>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the source of the backgroundColor property inheritance for FilledInput in Mui?

Recently, I encountered a challenge while working on Filled Inputs within forms using TextFields and FilledInput. I am seeking a more efficient solution to change the background color of all the FilledInputs. Currently, I am utilizing makeStyle and adding ...

Distribute divs of equal width evenly within a grid

I'm facing a unique challenge at the moment. I'm attempting to create a grid system where all elements have a fixed width of 200px each. What I envision is a clever grid setup using only CSS, where each "row" will strive to accommodate as many el ...

Optimizing web content for iOS Safari with min-height media queries

I'm currently working on a Bootstrap-based photo browser that needs to have a responsive 4:3 aspect ratio. To achieve this, I have implemented the following approach: #carousel { width: 320px; height: 240px; ... } Additionally, I utilize media ...

React: Encountered an expression in JSX where an assignment or function call was expected

Trying to build a left-hand menu for my test application using react. Encountering a compilation error in the JSX of one of my classes. Is it because HTML elements cannot be placed within {} scripts in JSX? If so, how do I fix this? ./src/components/Left ...

Is it possible to change Material UI DateRange Picker to a DateTimeRange Picker?

Thinking about getting the Material UI-X commercial license as I really need to use the DateRange picker component. However, it's important for me to be able to select a time range as well, and especially within the same day. Can the current state of ...

Get the selected row value from a Table and convert it into an array. Then, pass this array as a parameter to another function

I need help with logging and storing selected values from a Table component in React My Table component displays data from an API with checkboxes on each row. I'm using the <Table /> Material UI component for React. The documentation states th ...

What is the best way to make the current tab stand out?

I have implemented a TabHeader component to create a dynamic Tab Menu that displays table contents based on months. The loop runs from the current month back to January, and the content is updated dynamically through an API call triggered by changes in the ...

Experiencing unfamiliar typescript glitches while attempting to compile a turborepo initiative

I have been utilizing the turborepo-template for my project. Initially, everything was running smoothly until TypeScript suddenly started displaying peculiar errors. ../../packages/fork-me/src/client/star-me/star-me.tsx:19:4 nextjs-example:build: Type erro ...

Making a POST request to a Next.js API route results in a 500 Internal Server Error being sent back

Check out the code in createComment.ts file, which serves as a Next.js api route: import type { NextApiRequest, NextApiResponse } from 'next' import sanityClient from "@sanity/client" const config = { dataset: process.env.NEXT_PUBLI ...

Updating the active color for Material UI Input elements

I'm having trouble changing the color of an active input field. I want to customize it with my theme's primary color, but I can't figure out how to do it. I've tried adjusting the color attribute in various components like FormControl, ...

Trouble accessing Redux Connect() props in nested route of React Router 4

I'm having trouble accessing props from Redux connect() in my nested route. I can't seem to make it work. Here are the components involved: Main.js const initState = {}; const history = createBrowserHistory(); const store = configureStore(init ...

How can I dynamically populate my select field with JSON data using React.js?

My goal is to fetch data from an API and use the 'symbol' JSON field as options for a select dropdown. However, I'm encountering an issue: 'TypeError: Cannot read property 'length' of undefined.' Beneath my code, I' ...

Elements are not detected after applying display:none

Within the onLoad event, I implemented a function to hide multiple div elements by setting their CSS property display to "none" and assigning them the class name "invisible": function hideContent() { laElements = document.getElementById("content").chil ...

Unusual CSS rendering hiccup

Using jQuery, I am manipulating the display of an <a> element. Depending on certain keypress events, it adds or removes a class from an <input> element (which controls the display) that is related as a sibling to the mentioned <a>. The i ...

What sets apart Material UI from Material 2 Design in terms of appearance?

You can purchase a 79$ Figma version of MUI components at https://mui.com/store/#design, with a free demo version also available. Additionally, there is a free version of Material 2 Design Components that can be accessed through It seems that MUI is simp ...

Responsive images in Next JS with customized dimensions for optimal viewing experience

I'm currently working on creating an image grid similar to AirBnB using Next JS. To ensure responsiveness, I decided to use Next Image with a responsive layout. However, I ran into an issue where the images are not displaying as square - their height ...

Modifying the border hue of Material-UI's Select Component

Here is the Select component I've created using materials-UI <FormControl variant="outlined"> <Select value={this.state.value} onChange = {this.handleChange} className={this.props.classes.select} inputProps = {{class ...

Maintain dropdown menu visibility while navigating

I'm having an issue with my dropdown menu. It keeps sliding up when I try to navigate under the sub menu. I've spent all day trying to fix it, testing out various examples from the internet but so far, no luck. Any help would be greatly apprecia ...

Mobile browsers are displaying fonts unevenly within tables

Currently in the process of developing a desktop site () that should function optimally on mobile browsers without the need for a separate mobile version. While mobile Safari scales up fonts in large text blocks, tables used for content are causing some is ...

Mastering the art of seamless navigation within a single page through the magic of

I have two HTML pages: "Login.html" and "index.html". Instead of a normal href linking, I want the user to navigate to "index.html" when they click on the login button. Furthermore, I want the index page to be displayed within the codes of login.html, cre ...