{
  "format": "css.observer/playground@1",
  "id": "00000000-0000-4000-9000-000000000015",
  "url": "https://css.observer/u/observer/s/466s2ic89e",
  "title": "Toolbar tooltips",
  "description": "An editor toolbar whose tooltips show the action and its shortcut on hover or keyboard focus. CSS only.",
  "category": "effects",
  "tags": [
    "tooltip",
    "attr",
    "focus-visible"
  ],
  "visibility": "public",
  "status": "published",
  "revision": 1,
  "author": "observer",
  "forked_from": null,
  "created_at": "2026-12-02T09:24:56.169Z",
  "updated_at": "2026-12-02T09:24:56.169Z",
  "published_at": "2026-12-02T09:24:56.169Z",
  "source": {
    "html": "<div class=\"editor\">\n  <div class=\"toolbar\" role=\"toolbar\" aria-label=\"Formatting\">\n    <button type=\"button\" aria-label=\"Bold\" data-tip=\"Bold\" data-key=\"⌘B\"><b>B</b></button>\n    <button type=\"button\" aria-label=\"Italic\" data-tip=\"Italic\" data-key=\"⌘I\"><i style=\"font-family: Georgia, serif\">I</i></button>\n    <button type=\"button\" aria-label=\"Underline\" data-tip=\"Underline\" data-key=\"⌘U\"><u>U</u></button>\n    <span class=\"toolbar__sep\"></span>\n    <button type=\"button\" aria-label=\"Link\" data-tip=\"Insert link\" data-key=\"⌘K\"><svg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"><path d=\"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7\"/></svg></button>\n    <button type=\"button\" aria-label=\"Code\" data-tip=\"Inline code\" data-key=\"⌘E\"><svg viewBox=\"0 0 24 24\" width=\"17\" height=\"17\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\"><path d=\"M8 7l-5 5 5 5M16 7l5 5-5 5\"/></svg></button>\n  </div>\n  <p class=\"editor__body\">Select some text, then hover the toolbar or press <kbd>Tab</kbd> to move through it.</p>\n</div>",
    "css": "body {\n  margin: 0;\n  min-height: 100vh;\n  display: grid;\n  place-items: center;\n  background: #f3f2ee;\n  color: #1b1c20;\n  font: 15px/1.5 system-ui, sans-serif;\n}\n\n.editor {\n  width: min(440px, 100% - 32px);\n  padding: 72px 18px 20px;\n  border: 1px solid #e2dfd8;\n  border-radius: 16px;\n  background: #fff;\n}\n\n.toolbar {\n  display: flex;\n  align-items: center;\n  gap: 2px;\n  width: fit-content;\n  padding: 4px;\n  border: 1px solid #e6e3dc;\n  border-radius: 10px;\n  background: #faf9f7;\n}\n\n.toolbar__sep {\n  width: 1px;\n  height: 18px;\n  margin: 0 4px;\n  background: #e1ded7;\n}\n\n.toolbar button {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 34px;\n  height: 34px;\n  border: 0;\n  border-radius: 7px;\n  background: none;\n  color: #3d4048;\n  font: 600 15px system-ui, sans-serif;\n  cursor: pointer;\n}\n\n.toolbar button:hover,\n.toolbar button:focus-visible {\n  background: #edebe6;\n  outline: none;\n}\n\n.toolbar button::after,\n.toolbar button::before {\n  position: absolute;\n  left: 50%;\n  pointer-events: none;\n  opacity: 0;\n  transition: opacity 0.15s, transform 0.15s;\n}\n\n.toolbar button::after {\n  content: attr(data-tip) \"  \" attr(data-key);\n  bottom: calc(100% + 10px);\n  padding: 5px 9px;\n  border-radius: 7px;\n  background: #1b1c20;\n  color: #fff;\n  font: 500 12px/1.3 system-ui, sans-serif;\n  white-space: pre;\n  transform: translate(-50%, 4px);\n}\n\n.toolbar button::before {\n  content: \"\";\n  bottom: calc(100% + 5px);\n  border: 5px solid transparent;\n  border-top-color: #1b1c20;\n  border-bottom: 0;\n  transform: translate(-50%, 4px);\n}\n\n.toolbar button:hover::after,\n.toolbar button:hover::before {\n  opacity: 1;\n  transform: translate(-50%, 0);\n  transition-delay: 0.35s;\n}\n\n.toolbar button:focus-visible::after,\n.toolbar button:focus-visible::before {\n  opacity: 1;\n  transform: translate(-50%, 0);\n}\n\n.editor__body {\n  margin: 16px 0 0;\n  color: #5d6068;\n}\n\nkbd {\n  padding: 1px 5px;\n  border: 1px solid #dedbd4;\n  border-radius: 5px;\n  font: 12px ui-monospace, monospace;\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .toolbar button::after,\n  .toolbar button::before {\n    transition: none;\n  }\n}",
    "js": ""
  }
}