Notch toolbar
A dark toolbar joined to the bottom edge by two curved feet, with buttons, their keyboard shortcuts and a search that opens in place, shown over a grainy sunlit scene.
Dashboard Page
Projects Page
Invite a teammate Action
Billing Settings
Keyboard shortcuts Help
Sign out Action
Nothing matches that search.
Options
Code
import { useEffect, useRef, useState } from "react";
import "./notch-toolbar.css";
const icon = { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.6, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true };
const items = [
{ name: "Dashboard", kind: "Page" },
{ name: "Projects", kind: "Page" },
{ name: "Invite a teammate", kind: "Action" },
{ name: "Billing", kind: "Settings" },
{ name: "Keyboard shortcuts", kind: "Help" },
{ name: "Sign out", kind: "Action" },
];
export function NotchToolbar({ results = items, onPick }) {
const [open, setOpen] = useState(false);
const [query, setQuery] = useState("");
const [active, setActive] = useState(0);
const input = useRef(null);
const shown = results.filter((item) => item.name.toLowerCase().includes(query.trim().toLowerCase()));
useEffect(() => {
if (open) input.current?.focus();
}, [open]);
function start() {
setQuery("");
setActive(0);
setOpen(true);
}
function keys(event) {
if (event.key === "/" && event.target !== input.current) {
event.preventDefault();
start();
}
if (!open) return;
if (event.key === "Escape") setOpen(false);
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
event.preventDefault();
const step = event.key === "ArrowDown" ? 1 : -1;
setActive((value) => (shown.length ? (value + step + shown.length) % shown.length : 0));
}
if (event.key === "Enter" && shown[active]) onPick?.(shown[active]);
}
return (
<div className="dh-notch-frame" onKeyDown={keys}>
{open && (
<div className="dh-notch-results" role="listbox" aria-label="Results" style={{ width: 380 }}>
{shown.map((item, index) => (
<a
key={item.name}
href="#"
role="option"
aria-selected={index === active}
onPointerMove={() => setActive(index)}
onClick={() => onPick?.(item)}
>
{item.name} <span>{item.kind}</span>
</a>
))}
{shown.length === 0 && <p>Nothing matches that search.</p>}
</div>
)}
<div className="dh-notch" role="toolbar" aria-label="Quick actions" style={{ width: open ? 380 : undefined }}>
{open ? (
<label className="dh-notch-field">
<svg viewBox="0 0 14 14" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" aria-hidden>
<circle cx="6" cy="6" r="4.25" />
<path d="M9.5 9.5 12.5 12.5" />
</svg>
<input
ref={input}
type="text"
placeholder="Search"
aria-label="Search"
autoComplete="off"
spellCheck={false}
value={query}
onChange={(event) => {
setQuery(event.target.value);
setActive(0);
}}
/>
<button type="button" aria-label="Close search" onClick={() => setOpen(false)}><kbd>esc</kbd></button>
</label>
) : (
<div className="dh-notch-row">
<button type="button" aria-label="Menu">
<svg {...icon}><path d="M3 4.5h10M3 8h7M3 11.5h4" /></svg>
</button>
<button type="button" onClick={start}>Search <kbd>/</kbd></button>
<i />
<button type="button" aria-label="Previous">
<svg {...icon}><path d="M9.5 3.5 5 8l4.5 4.5" /></svg>
</button>
<button type="button" aria-label="Next">
<svg {...icon}><path d="M6.5 3.5 11 8l-4.5 4.5" /></svg>
</button>
<i />
<button type="button">Copy <kbd>C</kbd></button>
</div>
)}
</div>
</div>
);
}.dh-notch-frame {
position: relative;
aspect-ratio: 8 / 5;
min-height: 200px;
overflow: hidden;
background: #f3ead8 url("/blocks/notch-beam.jpg") center / cover no-repeat;
}
.dh-notch {
--fill: #1c1c1c;
--flare: 12px;
position: absolute;
bottom: 0;
left: 50%;
height: 40px;
box-sizing: border-box;
padding: 0 8px;
border-radius: 14px 14px 0 0;
background: var(--fill);
color: #fff;
font-family: inherit;
font-size: 12px;
line-height: 18px;
white-space: nowrap;
translate: -50% 0;
transition: width 440ms cubic-bezier(0.32, 0.72, 0, 1);
}
.dh-notch-row,
.dh-notch-field {
display: flex;
align-items: center;
gap: 2px;
height: 100%;
animation: dh-notch-in 260ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-notch-row[hidden],
.dh-notch-field[hidden],
.dh-notch-results[hidden],
.dh-notch-results [hidden] {
display: none;
}
@keyframes dh-notch-in {
from {
opacity: 0;
filter: blur(6px);
scale: 0.97;
}
}
.dh-notch-field {
gap: 8px;
padding: 0 0 0 6px;
}
.dh-notch-field > svg {
flex: none;
width: 14px;
height: 14px;
opacity: 0.6;
}
.dh-notch-field input {
min-width: 0;
flex: 1;
height: 28px;
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
outline: none;
}
.dh-notch-field input::placeholder {
color: rgb(255 255 255 / 0.5);
}
.dh-notch .dh-notch-field button {
padding: 0 4px;
}
.dh-notch-results {
position: absolute;
bottom: 52px;
left: 50%;
display: grid;
gap: 2px;
max-height: 232px;
box-sizing: border-box;
overflow-y: auto;
padding: 6px;
border-radius: 12px;
background: #1c1c1c;
color: #fff;
font-family: inherit;
font-size: 12px;
line-height: 18px;
translate: -50% 0;
box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 16px 32px -12px rgb(0 0 0 / 0.6);
animation: dh-notch-rise 260ms cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes dh-notch-rise {
from {
opacity: 0;
translate: -50% 8px;
}
}
.dh-notch-results a {
display: flex;
justify-content: space-between;
gap: 16px;
padding: 6px 10px;
border-radius: 7px;
color: inherit;
text-decoration: none;
}
.dh-notch-results a[aria-selected="true"] {
background: rgb(255 255 255 / 0.1);
}
.dh-notch-results span {
color: rgb(255 255 255 / 0.5);
}
.dh-notch-results p {
margin: 0;
padding: 12px 10px;
color: rgb(255 255 255 / 0.6);
text-align: center;
}
@media (prefers-reduced-motion: reduce) {
.dh-notch,
.dh-notch-row,
.dh-notch-field,
.dh-notch-results {
transition: none;
animation: none;
}
}
.dh-notch::before,
.dh-notch::after {
content: "";
position: absolute;
bottom: 0;
width: var(--flare);
height: var(--flare);
}
.dh-notch::before {
right: 100%;
background: radial-gradient(circle at 0 0, transparent calc(var(--flare) - 0.5px), var(--fill) var(--flare));
}
.dh-notch::after {
left: 100%;
background: radial-gradient(circle at 100% 0, transparent calc(var(--flare) - 0.5px), var(--fill) var(--flare));
}
.dh-notch button {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
min-width: 28px;
height: 28px;
padding: 0 4px 0 8px;
border: 0;
border-radius: 8px;
background: transparent;
color: inherit;
font: inherit;
font-weight: 500;
letter-spacing: -0.01em;
cursor: pointer;
transition: background-color 150ms cubic-bezier(0.23, 1, 0.32, 1), transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-notch button:has(> svg:only-child) {
padding: 0;
}
.dh-notch button:active {
transform: scale(0.92);
}
.dh-notch button:focus-visible {
outline: 2px solid #fff;
outline-offset: 2px;
}
.dh-notch svg {
width: 16px;
height: 16px;
}
.dh-notch kbd {
display: grid;
place-items: center;
min-width: 20px;
height: 20px;
box-sizing: border-box;
padding: 0 5px;
border-radius: 6px;
background: rgb(255 255 255 / 0.16);
font: 500 11px/1 inherit;
font-family: inherit;
box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.22);
}
.dh-notch i {
width: 1px;
height: 16px;
margin: 0 6px;
background: rgb(255 255 255 / 0.18);
}
@media (hover: hover) {
.dh-notch button:hover {
background: rgb(255 255 255 / 0.1);
}
}
@media (pointer: coarse) {
.dh-notch {
height: 52px;
}
.dh-notch button {
min-width: 44px;
height: 44px;
}
.dh-notch-field input {
height: 44px;
font-size: 16px;
}
.dh-notch-results {
bottom: 64px;
}
.dh-notch-results a {
padding: 12px 10px;
}
}<div class="dh-notch-frame">
<div class="dh-notch-results" role="listbox" aria-label="Results" hidden>
<a href="#" role="option" aria-selected="false">Dashboard <span>Page</span></a>
<a href="#" role="option" aria-selected="false">Projects <span>Page</span></a>
<a href="#" role="option" aria-selected="false">Invite a teammate <span>Action</span></a>
<a href="#" role="option" aria-selected="false">Billing <span>Settings</span></a>
<a href="#" role="option" aria-selected="false">Keyboard shortcuts <span>Help</span></a>
<a href="#" role="option" aria-selected="false">Sign out <span>Action</span></a>
<p hidden>Nothing matches that search.</p>
</div>
<div class="dh-notch" role="toolbar" aria-label="Quick actions">
<div class="dh-notch-row">
<button type="button" aria-label="Menu"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true"><path d="M3 4.5h10M3 8h7M3 11.5h4" /></svg></button>
<button type="button" data-notch-search>Search <kbd>/</kbd></button>
<i></i>
<button type="button" aria-label="Previous"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.5 3.5 5 8l4.5 4.5" /></svg></button>
<button type="button" aria-label="Next"><svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6.5 3.5 11 8l-4.5 4.5" /></svg></button>
<i></i>
<button type="button">Copy <kbd>C</kbd></button>
</div>
<label class="dh-notch-field" hidden>
<svg viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><circle cx="6" cy="6" r="4.25" /><path d="M9.5 9.5 12.5 12.5" /></svg>
<input type="text" placeholder="Search" aria-label="Search" autocomplete="off" spellcheck="false" />
<button type="button" aria-label="Close search" data-notch-close><kbd>esc</kbd></button>
</label>
</div>
</div>.dh-notch-frame {
position: relative;
aspect-ratio: 8 / 5;
min-height: 200px;
overflow: hidden;
background: #f3ead8 url("/blocks/notch-beam.jpg") center / cover no-repeat;
}
.dh-notch {
--fill: #1c1c1c;
--flare: 12px;
position: absolute;
bottom: 0;
left: 50%;
height: 40px;
box-sizing: border-box;
padding: 0 8px;
border-radius: 14px 14px 0 0;
background: var(--fill);
color: #fff;
font-family: inherit;
font-size: 12px;
line-height: 18px;
white-space: nowrap;
translate: -50% 0;
transition: width 440ms cubic-bezier(0.32, 0.72, 0, 1);
}
.dh-notch-row,
.dh-notch-field {
display: flex;
align-items: center;
gap: 2px;
height: 100%;
animation: dh-notch-in 260ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-notch-row[hidden],
.dh-notch-field[hidden],
.dh-notch-results[hidden],
.dh-notch-results [hidden] {
display: none;
}
@keyframes dh-notch-in {
from {
opacity: 0;
filter: blur(6px);
scale: 0.97;
}
}
.dh-notch-field {
gap: 8px;
padding: 0 0 0 6px;
}
.dh-notch-field > svg {
flex: none;
width: 14px;
height: 14px;
opacity: 0.6;
}
.dh-notch-field input {
min-width: 0;
flex: 1;
height: 28px;
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
outline: none;
}
.dh-notch-field input::placeholder {
color: rgb(255 255 255 / 0.5);
}
.dh-notch .dh-notch-field button {
padding: 0 4px;
}
.dh-notch-results {
position: absolute;
bottom: 52px;
left: 50%;
display: grid;
gap: 2px;
max-height: 232px;
box-sizing: border-box;
overflow-y: auto;
padding: 6px;
border-radius: 12px;
background: #1c1c1c;
color: #fff;
font-family: inherit;
font-size: 12px;
line-height: 18px;
translate: -50% 0;
box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 16px 32px -12px rgb(0 0 0 / 0.6);
animation: dh-notch-rise 260ms cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes dh-notch-rise {
from {
opacity: 0;
translate: -50% 8px;
}
}
.dh-notch-results a {
display: flex;
justify-content: space-between;
gap: 16px;
padding: 6px 10px;
border-radius: 7px;
color: inherit;
text-decoration: none;
}
.dh-notch-results a[aria-selected="true"] {
background: rgb(255 255 255 / 0.1);
}
.dh-notch-results span {
color: rgb(255 255 255 / 0.5);
}
.dh-notch-results p {
margin: 0;
padding: 12px 10px;
color: rgb(255 255 255 / 0.6);
text-align: center;
}
@media (prefers-reduced-motion: reduce) {
.dh-notch,
.dh-notch-row,
.dh-notch-field,
.dh-notch-results {
transition: none;
animation: none;
}
}
.dh-notch::before,
.dh-notch::after {
content: "";
position: absolute;
bottom: 0;
width: var(--flare);
height: var(--flare);
}
.dh-notch::before {
right: 100%;
background: radial-gradient(circle at 0 0, transparent calc(var(--flare) - 0.5px), var(--fill) var(--flare));
}
.dh-notch::after {
left: 100%;
background: radial-gradient(circle at 100% 0, transparent calc(var(--flare) - 0.5px), var(--fill) var(--flare));
}
.dh-notch button {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
min-width: 28px;
height: 28px;
padding: 0 4px 0 8px;
border: 0;
border-radius: 8px;
background: transparent;
color: inherit;
font: inherit;
font-weight: 500;
letter-spacing: -0.01em;
cursor: pointer;
transition: background-color 150ms cubic-bezier(0.23, 1, 0.32, 1), transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-notch button:has(> svg:only-child) {
padding: 0;
}
.dh-notch button:active {
transform: scale(0.92);
}
.dh-notch button:focus-visible {
outline: 2px solid #fff;
outline-offset: 2px;
}
.dh-notch svg {
width: 16px;
height: 16px;
}
.dh-notch kbd {
display: grid;
place-items: center;
min-width: 20px;
height: 20px;
box-sizing: border-box;
padding: 0 5px;
border-radius: 6px;
background: rgb(255 255 255 / 0.16);
font: 500 11px/1 inherit;
font-family: inherit;
box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.22);
}
.dh-notch i {
width: 1px;
height: 16px;
margin: 0 6px;
background: rgb(255 255 255 / 0.18);
}
@media (hover: hover) {
.dh-notch button:hover {
background: rgb(255 255 255 / 0.1);
}
}
@media (pointer: coarse) {
.dh-notch {
height: 52px;
}
.dh-notch button {
min-width: 44px;
height: 44px;
}
.dh-notch-field input {
height: 44px;
font-size: 16px;
}
.dh-notch-results {
bottom: 64px;
}
.dh-notch-results a {
padding: 12px 10px;
}
}document.querySelectorAll(".dh-notch-frame").forEach((frame) => {
const notch = frame.querySelector(".dh-notch");
if (!notch || notch.dataset.ready) return;
notch.dataset.ready = "true";
const row = notch.querySelector(".dh-notch-row");
const field = notch.querySelector(".dh-notch-field");
const input = field.querySelector("input");
const trigger = notch.querySelector("[data-notch-search]");
const results = frame.querySelector(".dh-notch-results");
const options = [...results.querySelectorAll("a")];
const empty = results.querySelector("p");
let shown = options;
let active = 0;
const select = (index) => {
active = shown.length ? (index + shown.length) % shown.length : -1;
options.forEach((option) => option.setAttribute("aria-selected", String(option === shown[active])));
shown[active]?.scrollIntoView({ block: "nearest" });
};
const filter = () => {
const words = input.value.trim().toLowerCase();
shown = options.filter((option) => {
option.hidden = !option.textContent.toLowerCase().includes(words);
return !option.hidden;
});
empty.hidden = shown.length > 0;
select(0);
};
const slide = (from, to) => {
notch.style.width = from + "px";
notch.offsetWidth;
notch.style.width = to + "px";
};
const open = () => {
if (row.hidden) return input.focus();
const from = notch.offsetWidth;
const to = Math.min(380, frame.clientWidth - 48);
row.hidden = true;
field.hidden = false;
results.hidden = false;
results.style.width = to + "px";
input.value = "";
filter();
slide(from, to);
input.focus();
};
const close = () => {
if (!field.hidden) {
const from = notch.offsetWidth;
field.hidden = true;
results.hidden = true;
row.hidden = false;
notch.style.width = "";
slide(from, notch.offsetWidth);
trigger.focus();
}
};
trigger.addEventListener("click", open);
notch.querySelector("[data-notch-close]").addEventListener("click", close);
notch.addEventListener("transitionend", () => row.hidden || (notch.style.width = ""));
input.addEventListener("input", filter);
options.forEach((option) => option.addEventListener("pointermove", () => select(shown.indexOf(option))));
frame.addEventListener("keydown", (event) => {
if (event.key === "/" && event.target !== input) {
event.preventDefault();
event.stopPropagation();
open();
}
if (field.hidden) return;
if (event.key === "Escape") {
event.preventDefault();
event.stopPropagation();
close();
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
event.preventDefault();
select(active + (event.key === "ArrowDown" ? 1 : -1));
} else if (event.key === "Enter") {
shown[active]?.click();
}
});
frame.addEventListener("pointerdown", (event) => {
if (!event.target.closest(".dh-notch, .dh-notch-results")) close();
});
});Notch toolbar is not in the Figma file yet.
Use the React or HTML code for now.