Make copy of google drive UI
- User
Make copy of google drive UI
Assistant
Of course! Here is a copy of the Google Drive UI created with HTML, CSS, and a little bit of JavaScript for interactivity.
This code is a simplified, static representation focusing on the visual layout and key interactive elements like switching between grid and list view.
Features Included:
- Layout: The classic 3-part layout (Header, Left Sidebar, Main Content).
- Header: Search bar and user icons.
- Sidebar: "New" button, navigation links, and storage indicator.
- Main Content: A file/folder area with a header.
- Interactivity: A functional toggle to switch between Grid View and List View.
- Styling: Uses CSS variables for colors and spacing to mimic Google's design.
- Icons: Uses embedded SVG for icons, so no external files are needed.
Live Preview
You can see a live version of this code here: CodePen - Google Drive UI Clone
The Code
Just copy and paste the following code into a single
index.htmlfile and open it in your browser.<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Google Drive UI Clone</title> <style> /* --- Global Styles & Variables --- */ :root { --g-main-bg-color: #ffffff; --g-secondary-bg-color: #f8f9fa; --g-border-color: #dadce0; --g-text-color: #3c4043; --g-secondary-text-color: #5f6368; --g-accent-color: #1a73e8; --g-hover-bg-color: #e8f0fe; --g-active-bg-color: #d2e3fc; --g-font-family: 'Roboto', 'Noto Sans', sans-serif; --g-sidebar-width: 256px; --g-header-height: 64px; } body { margin: 0; font-family: var(--g-font-family); font-size: 14px; color: var(--g-text-color); background-color: var(--g-secondary-bg-color); overflow: hidden; /* Prevent body scroll */ } * { box-sizing: border-box; } /* --- Main Layout --- */ .drive-container { display: grid; grid-template-columns: var(--g-sidebar-width) 1fr; grid-template-rows: var(--g-header-height) 1fr; grid-template-areas: "header header" "sidebar main"; height: 100vh; } /* --- Header --- */ .drive-header { grid-area: header; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background-color: var(--g-main-bg-color); border-bottom: 1px solid var(--g-border-color); } .header-left { display: flex; align-items: center; } .header-logo { display: flex; align-items: center; font-size: 22px; color: var(--g-secondary-text-color); padding-right: 20px; } .header-logo img { width: 40px; height: 40px; margin-right: 8px; } .search-bar { display: flex; align-items: center; background-color: var(--g-secondary-bg-color); border-radius: 8px; padding: 8px 12px; width: 720px; } .search-bar input { border: none; background: transparent; outline: none; font-size: 16px; width: 100%; margin-left: 12px; } .search-bar svg { fill: var(--g-secondary-text-color); } .header-right { display: flex; align-items: center; } .header-right .icon-button { background: none; border: none; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-left: 8px; } .header-right .icon-button:hover { background-color: #f1f3f4; } .header-right svg { fill: var(--g-secondary-text-color); } .user-profile { width: 32px; height: 32px; border-radius: 50%; background-color: #6c5ce7; color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; margin-left: 16px; cursor: pointer; } /* --- Sidebar --- */ .sidebar { grid-area: sidebar; background-color: var(--g-main-bg-color); padding: 16px 8px; border-right: 1px solid var(--g-border-color); display: flex; flex-direction: column; } .new-button { display: flex; align-items: center; background-color: var(--g-main-bg-color); border: 1px solid var(--g-border-color); box-shadow: 0 1px 2px 0 rgba(60,64,67,0.302), 0 1px 3px 1px rgba(60,64,67,0.149); border-radius: 24px; padding: 12px 24px 12px 16px; font-size: 14px; font-weight: 500; margin-left: 8px; margin-bottom: 16px; cursor: pointer; transition: box-shadow 0.2s; width: fit-content; } .new-button:hover { box-shadow: 0 1px 3px 0 rgba(60,64,67,0.302), 0 4px 8px 3px rgba(60,64,67,0.149); } .new-button svg { width: 36px; height: 36px; margin-right: 12px; } .sidebar-nav ul { list-style: none; padding: 0; margin: 0; } .sidebar-nav li a { display: flex; align-items: center; padding: 8px 24px; border-radius: 0 20px 20px 0; text-decoration: none; color: var(--g-text-color); font-weight: 500; } .sidebar-nav li a svg { margin-right: 20px; fill: var(--g-secondary-text-color); } .sidebar-nav li a:hover { background-color: var(--g-hover-bg-color); } .sidebar-nav li a.active { background-color: var(--g-active-bg-color); color: var(--g-accent-color); font-weight: bold; } .sidebar-nav li a.active svg { fill: var(--g-accent-color); } .storage-status { margin-top: auto; /* Pushes to the bottom */ padding: 16px 24px; } .storage-status p { margin: 0 0 8px 0; font-size: 13px; } .storage-bar { width: 100%; height: 4px; background-color: #e0e0e0; border-radius: 2px; } .storage-bar-fill { width: 45%; /* Example: 45% full */ height: 100%; background-color: var(--g-accent-color); border-radius: 2px; } /* --- Main Content --- */ .main-content { grid-area: main; background-color: var(--g-main-bg-color); padding: 24px; overflow-y: auto; /* Enable scrolling for content */ } .content-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--g-border-color); } .content-header h1 { font-size: 24px; font-weight: 400; color: var(--g-text-color); margin: 0; } .view-controls .icon-button { background: none; border: none; padding: 6px; border-radius: 50%; cursor: pointer; margin-left: 8px; } .view-controls .icon-button:hover { background-color: #f1f3f4; } .view-controls .icon-button svg { fill: var(--g-secondary-text-color); } .view-controls .icon-button.active svg { fill: var(--g-accent-color); } /* --- File Grid & List --- */ .files-container { padding-top: 24px; } .files-container.grid-view .file-item { display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: var(--g-secondary-bg-color); border: 1px solid var(--g-border-color); border-radius: 8px; padding: 16px; cursor: pointer; text-align: center; } .files-container.grid-view .file-item:hover { background-color: var(--g-hover-bg-color); border-color: var(--g-accent-color); } .files-container.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; } .files-container.grid-view .file-icon { margin-bottom: 12px; } .files-container.grid-view .file-icon svg { width: 48px; height: 48px; } .files-container.grid-view .file-name { word-break: break-all; } /* List View Styles */ .files-container.list-view { display: flex; flex-direction: column; } .files-container.list-view .list-header { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr; padding: 8px 12px; font-weight: 500; color: var(--g-secondary-text-color); border-bottom: 1px solid var(--g-border-color); } .files-container.list-view .file-item { display: grid; grid-template-columns: 3fr 1fr 1fr 1fr; align-items: center; padding: 12px; border-bottom: 1px solid var(--g-border-color); border-radius: 4px; cursor: pointer; } .files-container.list-view .file-item:hover { background-color: #f1f3f4; } .files-container.list-view .file-name-cell { display: flex; align-items: center; } .files-container.list-view .file-icon svg { width: 24px; height: 24px; margin-right: 16px; } .files-container.list-view .file-meta { color: var(--g-secondary-text-color); } </style> </head> <body> <div class="drive-container"> <!-- HEADER --> <header class="drive-header"> <div class="header-left"> <div class="header-logo"> <img src="https://ssl.gstatic.com/images/branding/product/1x/drive_2020q4_48dp.png" alt="Google Drive Logo"> <span>Drive</span> </div> </div> <div class="search-bar"> <svg focusable="false" height="24px" viewBox="0 0 24 24" width="24px"><path d="M20.49,19l-5.73-5.73C15.53,12.2,16,10.91,16,9.5C16,5.91,13.09,3,9.5,3S3,5.91,3,9.5C3,13.09,5.91,16,9.5,16 c1.41,0,2.7-0.47,3.77-1.24L19,20.49L20.49,19z M5,9.5C5,7.01,7.01,5,9.5,5S14,7.01,14,9.5S11.99,14,9.5,14S5,11.99,5,9.5z"></path></svg> <input type="text" placeholder="Search in Drive"> </div> <div class="header-right"> <button class="icon-button"> <svg focusable="false" height="24px" viewBox="0 0 24 24" width="24px"><path d="M11,18h2v-2h-2V18z M12,2C6.48,2,2,6.48,2,12s4.48,10,10,10s10-4.48,10-10S17.52,2,12,2z M12,20c-4.41,0-8-3.59-8-8 s3.59-8,8-8s8,3.59,8,8S16.41,20,12,20z M12,6c-2.21,0-4,1.79-4,4h2c0-1.1,0.9-2,2-2s2,0.9,2,2c0,2-3,1.75-3,5h2c0-2.25,3-2.5,3-5 C16,7.79,14.21,6,12,6z"></path></svg> </button> <button class="icon-button"> <svg focusable="false" height="24px" viewBox="0 0 24 24" width="24px"><path d="M19.43,12.98c0.04-0.32,0.07-0.64,0.07-0.98s-0.03-0.66-0.07-0.98l2.11-1.65c0.19-0.15,0.24-0.42,0.12-0.64l-2-3.46 c-0.12-0.22-0.39-0.3-0.61-0.22l-2.49,1c-0.52-0.4-1.08-0.73-1.69-0.98l-0.38-2.65C14.46,2.18,14.25,2,14,2h-4 c-0.25,0-0.46,0.18-0.49,0.42L9.13,5.07c-0.61,0.25-1.17,0.59-1.69,0.98l-2.49-1c-0.23-0.09-0.49,0-0.61,0.22l-2,3.46 c-0.12,0.22-0.07,0.49,0.12,0.64l2.11,1.65C4.57,11.34,4.5,11.66,4.5,12s0.07,0.66,0.1,0.98l-2.11,1.65c-0.19,0.15-0.24,0.42-0.12,0.64 l2,3.46c0.12,0.22,0.39,0.3,0.61,0.22l2.49-1c0.52,0.4,1.08,0.73,1.69,0.98l0.38,2.65C9.54,21.82,9.75,22,10,22h4 c0.25,0,0.46-0.18,0.49-0.42l0.38-2.65c0.61-0.25,1.17-0.59,1.69-0.98l2.49,1c0.23,0.09,0.49,0,0.61-0.22l2-3.46 C21.93,13.49,21.88,13.22,21.76,13.07L19.43,12.98z M12,15.5c-1.93,0-3.5-1.57-3.5-3.5s1.57-3.5,3.5-3.5s3.5,1.57,3.5,3.5 S13.93,15.5,12,15.5z"></path></svg> </button> <div class="user-profile">A</div> </div> </header> <!-- SIDEBAR --> <nav class="sidebar"> <button class="new-button"> <svg height="24px" viewBox="0 0 24 24" width="24px"><path d="M0 0h24v24H0z" fill="none"></path><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path></svg> <span>New</span> </button> <nav class="sidebar-nav"> <ul> <li><a href="#" class="active" id="my-drive-link"> <svg width="24" height="24" viewBox="0 0 24 24"><path d="M19.48 11.23L12.71 2.1a1 1 0 00-1.42 0l-6.77 9.13A.5.5 0 005 12h14a.5.5 0 00.48-.77z"></path><path d="M21 14H3a1 1 0 00-1 1v2a1 1 0 001 1h18a1 1 0 001-1v-2a1 1 0 00-1-1z"></path></svg> <span>My Drive</span> </a></li> <li><a href="#"> <svg width="24" height="24" viewBox="0 0 24 24"><path d="M14 6H4a2 2 0 00-2 2v10a2 2 0 002 2h16a2 2 0 002-2V8a2 2 0 00-2-2h-6l-2-2z"></path></svg> <span>Computers</span> </a></li> <li><a href="#"> <svg width="24" height="24" viewBox="0 0 24 24"><path d="M17 10.5V7c0-2.21-1.79-4-4-4s-4 1.79-4 4v3.5c-1.93 0-3.5 1.57-3.5 3.5s1.57 3.5 3.5 3.5h8c1.93 0 3.5-1.57 3.5-3.5S18.93 10.5 17 10.5zM15 7c0-1.1-.9-2-2-2s-2 .9-2 2v3h4V7z"></path></svg> <span>Shared with me</span> </a></li> <li><a href="#"> <svg width="24" height="24" viewBox="0 0 24 24"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"></path></svg> <span>Recent</span> </a></li> <li><a href="#"> <svg width="24" height="24" viewBox="0 0 24 24"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"></path></svg> <span>Starred</span> </a></li> <li><a href="#"> <svg width="24" height="24" viewBox="0 0 24 24"><path d="M15 4V3H9v1H4v2h1v13c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V6h1V4h-5zm-6-2h4v1H9V2zM7 19V6h10v13H7z"></path></svg> <span>Trash</span> </a></li> </ul> </nav> <div class="storage-status"> <p>Storage</p> <div class="storage-bar"> <div class="storage-bar-fill"></div> </div> <p>6.7 GB of 15 GB used</p> </div> </nav> <!-- MAIN CONTENT --> <main class="main-content"> <header class="content-header"> <h1>My Drive</h1> <div class="view-controls"> <button class="icon-button" id="list-view-btn"> <svg width="24" height="24" viewBox="0 0 24 24"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path></svg> </button> <button class="icon-button active" id="grid-view-btn"> <svg width="24" height="24" viewBox="0 0 24 24"><path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"></path></svg> </button> </div> </header> <div class="files-container grid-view" id="files-container"> <!-- This will be populated by JS in a real app, here it's static --> <div class="list-header" style="display: none;"> <span>Name</span> <span>Owner</span> <span>Last modified</span> <span>File size</span> </div> <!-- Sample Folder --> <div class="file-item"> <div class="file-name-cell"> <div class="file-icon"> <svg fill="#5f6368" width="24px" height="24px" viewBox="0 0 24 24"><path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"></path></svg> </div> <span class="file-name">Project Alpha</span> </div> <span class="file-meta">Me</span> <span class="file-meta">Oct 26, 2023</span> <span class="file-meta">--</span> </div> <!-- Sample File --> <div class="file-item"> <div class="file-name-cell"> <div class="file-icon"> <svg fill="#4285F4" width="24px" height="24px" viewBox="0 0 24 24"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM16 18H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"></path></svg> </div> <span class="file-name">Q4_Report.gdoc</span> </div> <span class="file-meta">Me</span> <span class="file-meta">Oct 25, 2023</span> <span class="file-meta">1.2 MB</span> </div> <!-- Sample Image --> <div class="file-item"> <div class="file-name-cell"> <div class="file-icon"> <svg fill="#DB4437" width="24px" height="24px" viewBox="0 0 24 24"><path d="M21.58 9.59l-7.17-7.17C14.25 2.25 14.01 2 13.75 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10.25c0-.26-.09-.5-.25-.66zM13 3.5l5.5 5.5H13V3.5zM6 20V4h6v6h6v8H6z"></path></svg> </div> <span class="file-name">Company_Headshot.jpg</span> </div> <span class="file-meta">John Doe</span> <span class="file-meta">Sep 15, 2023</span> <span class="file-meta">4.8 MB</span> </div> <!-- Sample Spreadsheet --> <div class="file-item"> <div class="file-name-cell"> <div class="file-icon"> <svg fill="#0F9D58" width="24px" height="24px" viewBox="0 0 24 24"><path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zM15 13h-2v2h-2v-2H9v-2h2v-2h2v2h2v2zm-1-8V3.5L18.5 9H14z"></path></svg> </div> <span class="file-name">Financials.gsheet</span> </div> <span class="file-meta">Me</span> <span class="file-meta">Aug 01, 2023</span> <span class="file-meta">876 KB</span> </div> </div> </main> </div> <script> const gridViewBtn = document.getElementById('grid-view-btn'); const listViewBtn = document.getElementById('list-view-btn'); const filesContainer = document.getElementById('files-container'); const listHeader = filesContainer.querySelector('.list-header'); gridViewBtn.addEventListener('click', () => { filesContainer.classList.remove('list-view'); filesContainer.classList.add('grid-view'); gridViewBtn.classList.add('active'); listViewBtn.classList.remove('active'); listHeader.style.display = 'none'; }); listViewBtn.addEventListener('click', () => { filesContainer.classList.remove('grid-view'); filesContainer.classList.add('list-view'); listViewBtn.classList.add('active'); gridViewBtn.classList.remove('active'); listHeader.style.display = 'grid'; }); // Sidebar active link const navLinks = document.querySelectorAll('.sidebar-nav a'); navLinks.forEach(link => { link.addEventListener('click', function(e) { // In a real app, you'd prevent default and load content. // e.preventDefault(); navLinks.forEach(l => l.classList.remove('active')); this.classList.add('active'); }); }); </script> </body> </html>How to Improve This
This is a great starting point. To make it a fully functional application, you would need to:
- Add a Backend: Use a server-side language (like Node.js, Python, or Go) and a database to store user data, files, and folder structures.
- Dynamic Rendering: Use JavaScript to fetch the file/folder data from your backend API and dynamically create the HTML elements for each item instead of hardcoding them.
- Right-Click Context Menu: Implement a custom context menu that appears when a user right-clicks on a file or folder.
- File/Folder Actions: Add functionality to the "New" button, and implement actions like rename, delete, share, and download.
- Drag and Drop: Implement drag-and-drop functionality for uploading files and moving items between folders.
- Details Pane: Create the right-hand sidebar that appears when a file is selected, showing its details, activity, and sharing status.
- Routing: For a Single Page Application (SPA) feel, use a JavaScript router to handle navigation between "My Drive," "Shared with me," etc., without full page reloads.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.