Create a beautiful notes webapp
- User
Create a beautiful notes webapp
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Create a beautiful notes webapp
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Below is a complete, lightweight “Beautiful Notes” web-app that runs 100 % on the front-end (no build tools, no backend).
Just drop the three files in the same folder, open index.html, and you’re good to go ✨
–––––– 1. index.html ––––––
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Beautiful Notes</title>
<link rel="stylesheet" href="styles.css" />
<!-- Google Font for a modern vibe -->
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
</head>
<body>
<header>
<h1>📝 Beautiful Notes</h1>
<button id="themeToggle" aria-label="Toggle theme">🌙</button>
</header>
<main>
<!-- New-note composer -->
<section id="composer">
<textarea id="noteInput" placeholder="Type your note here…"></textarea>
<button id="addBtn">Add Note</button>
</section>
<!-- Live search -->
<input type="search" id="searchInput" placeholder="Search notes…" />
<!-- Notes grid -->
<section id="notesContainer"></section>
</main>
<footer>
<span>Made with ❤️, vanilla JS & localStorage</span>
</footer>
<script src="app.js"></script>
</body>
</html>
–––––– 2. styles.css ––––––
/* ───────── CSS Reset (mini) ───────── */
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
/* ───────── Theme Variables ───────── */
:root{
--bg: #f7f7f9;
--card-bg:#fff;
--card-border:#ebebef;
--text-main:#333;
--accent:#4F46E5; /* indigo-600 */
--accent-dark:#4338CA;
}
[data-theme="dark"]{
--bg:#1e1f24;
--card-bg:#26272d;
--card-border:#35363c;
--text-main:#e5e5ec;
--accent:#60a5fa; /* blue-400 */
--accent-dark:#3b82f6;
}
/* ───────── Global Styles ───────── */
body{
background:var(--bg);
color:var(--text-main);
font-family:'Poppins',sans-serif;
display:flex;
flex-direction:column;
min-height:100vh;
}
header,footer{
padding:1rem 2rem;
display:flex;
align-items:center;
justify-content:space-between;
}
header h1{font-weight:600;font-size:1.7rem}
footer{font-size:.8rem;opacity:.8}
main{
width:100%;
max-width:900px;
margin:0 auto;
flex:1;
padding:1rem 2rem 3rem;
display:flex;
flex-direction:column;
gap:1.2rem;
}
#composer{
display:flex;
flex-direction:column;
gap:.6rem;
}
#noteInput{
resize:none;
min-height:90px;
padding:.8rem 1rem;
border:1px solid var(--card-border);
border-radius:8px;
font-size:.9rem;
background:var(--card-bg);
color:var(--text-main);
}
#addBtn{
align-self:flex-end;
padding:.55rem 1.3rem;
background:var(--accent);
color:#fff;
border:none;
border-radius:6px;
cursor:pointer;
font-weight:500;
transition:.2s;
}
#addBtn:hover{background:var(--accent-dark)}
#searchInput{
padding:.6rem 1rem;
border:1px solid var(--card-border);
background:var(--card-bg);
color:var(--text-main);
border-radius:50px;
font-size:.85rem;
width:100%;
}
#notesContainer{
display:grid;
grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
gap:1rem;
}
.note{
background:var(--card-bg);
border:1px solid var(--card-border);
border-radius:10px;
padding:1rem;
position:relative;
white-space:pre-wrap;
word-break:break-word;
min-height:120px;
transition:.25s;
}
.note:hover{transform:translateY(-4px)}
.note .actions{
position:absolute;
top:.4rem; right:.5rem;
display:flex; gap:.4rem;
}
.note button{
background:none;
border:none;
cursor:pointer;
font-size:1.05rem;
color:var(--text-main);
opacity:.7;
transition:.2s;
}
.note button:hover{opacity:1;color:var(--accent)}
@media(max-width:600px){
header h1{font-size:1.4rem}
#composer textarea{min-height:70px}
}
–––––– 3. app.js ––––––
/* ===== Helpers ===== */
const $ = q => document.querySelector(q);
const $$ = q => document.querySelectorAll(q);
const LS_KEY = "beautiful_notes";
/* ===== DOM references ===== */
const noteInput = $("#noteInput");
const addBtn = $("#addBtn");
const notesContainer = $("#notesContainer");
const searchInput = $("#searchInput");
const themeToggle = $("#themeToggle");
/* ===== State ===== */
let notes = JSON.parse(localStorage.getItem(LS_KEY) || "[]");
/* ===== Functions ===== */
function saveNotes() {
localStorage.setItem(LS_KEY, JSON.stringify(notes));
}
function createNoteHTML(text, id) {
return `
<div class="note" data-id="${id}">
<div class="actions">
<button class="editBtn" aria-label="Edit"> ✏️</button>
<button class="delBtn" aria-label="Delete"> 🗑️</button>
</div>
<div class="text">${text}</div>
</div>`;
}
function render(filter="") {
const html = notes
.filter(n => n.text.toLowerCase().includes(filter.toLowerCase()))
.map(n => createNoteHTML(n.text, n.id))
.join("");
notesContainer.innerHTML = html || "<p style='opacity:.6'>No notes yet…</p>";
}
function addNote() {
const text = noteInput.value.trim();
if(!text) return;
const note = { id: Date.now(), text };
notes.unshift(note);
saveNotes();
noteInput.value="";
render(searchInput.value);
}
function deleteNote(id) {
notes = notes.filter(n => n.id !== id);
saveNotes();
render(searchInput.value);
}
function editNote(id) {
const note = notes.find(n => n.id === id);
const newText = prompt("Edit your note:", note.text);
if (newText !== null) {
note.text = newText.trim();
saveNotes();
render(searchInput.value);
}
}
/* ===== Event Listeners ===== */
addBtn.addEventListener("click", addNote);
noteInput.addEventListener("keypress", e => {
if(e.key==="Enter" && !e.shiftKey){
e.preventDefault(); addNote();
}
});
notesContainer.addEventListener("click", e => {
const parent = e.target.closest(".note");
if(!parent) return;
const id = +parent.dataset.id;
if(e.target.classList.contains("delBtn")) deleteNote(id);
if(e.target.classList.contains("editBtn")) editNote(id);
});
searchInput.addEventListener("input", () => render(searchInput.value));
/* ===== Theme toggling ===== */
function setTheme(isDark){
document.documentElement.dataset.theme = isDark? "dark":"";
themeToggle.textContent = isDark? "☀️":"🌙";
localStorage.setItem("theme", isDark? "dark":"light");
}
themeToggle.addEventListener("click",() =>{
setTheme(document.documentElement.dataset.theme!=="dark");
});
setTheme(localStorage.getItem("theme")==="dark");
/* ===== Initial render ===== */
render();
How it looks & works
• Minimal, calming UI embracing whitespace and soft colors.
• Quick-add notes (Shift-Enter for new line, Enter to submit).
• Live search filters instantly.
• Edit ✏️ or delete 🗑️ each note.
• Automatic light / dark mode with one click, preference saved.
• All data is persisted in localStorage, so your notes survive reloads.
Ideas for leveling-up
Enjoy your sleek little notes app! 🥳