{
  "id": "format-toggle-buttons",
  "name": "Format Toggle Buttons",
  "category": "buttons",
  "tags": [
    "bold",
    "italic",
    "toolbar",
    "editor",
    "pressed",
    "checkbox"
  ],
  "description": "A text editor toolbar of bold, italic, underline and strike toggles that stay pressed when on.",
  "url": "https://copy-css.com/snippets/format-toggle-buttons",
  "markdown": "https://copy-css.com/snippets/format-toggle-buttons.md",
  "html": "<fieldset class=\"format-toggles\">\n  <legend class=\"format-toggles-legend\">Text style</legend>\n  <label><input type=\"checkbox\" aria-label=\"Bold\" checked><b aria-hidden=\"true\">B</b></label>\n  <label><input type=\"checkbox\" aria-label=\"Italic\"><i aria-hidden=\"true\">I</i></label>\n  <label><input type=\"checkbox\" aria-label=\"Underline\"><u aria-hidden=\"true\">U</u></label>\n  <label><input type=\"checkbox\" aria-label=\"Strikethrough\"><s aria-hidden=\"true\">S</s></label>\n</fieldset>",
  "css": ".format-toggles {\n  display: inline-flex;\n  gap: 2px;\n  margin: 0;\n  padding: 4px;\n  border: 1px solid #e2e8f0;\n  border-radius: 12px;\n  background: #fff;\n  box-shadow: 0 1px 2px #0f172a14;\n}\n\n.format-toggles-legend {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  overflow: hidden;\n  clip-path: inset(50%);\n  white-space: nowrap;\n}\n\n.format-toggles label {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 38px;\n  height: 38px;\n  border-radius: 8px;\n  color: #475569;\n  font: 17px/1 Georgia, \"Times New Roman\", serif;\n  cursor: pointer;\n  transition: background-color 0.15s ease, color 0.15s ease;\n}\n\n.format-toggles input {\n  position: absolute;\n  inset: 0;\n  margin: 0;\n  opacity: 0;\n  cursor: pointer;\n}\n\n.format-toggles label:hover {\n  background: #f1f5f9;\n  color: #0f172a;\n}\n\n.format-toggles label:has(input:checked) {\n  background: #e0e7ff;\n  color: #3730a3;\n}\n\n.format-toggles label:has(input:focus-visible) {\n  outline: 2px solid #4f46e5;\n  outline-offset: 1px;\n}",
  "features": [
    "transitions",
    "box shadows",
    "clip paths",
    "CSS Grid",
    "Flexbox",
    "the :has() selector",
    "the :checked state (no JavaScript)",
    "keyboard focus styles"
  ],
  "customProperties": []
}
