{
  "format": "css.observer/playground@1",
  "id": "00000000-0000-4000-9000-000000000009",
  "url": "https://css.observer/s/sign-in-card",
  "title": "Sign-in card",
  "description": "A complete sign-in form: social buttons, labelled fields, a show/hide password toggle, and errors that only appear after you've typed.",
  "category": "forms",
  "tags": [
    "form",
    "user-invalid",
    "accessibility"
  ],
  "visibility": "public",
  "status": "published",
  "revision": 1,
  "author": "observer",
  "forked_from": null,
  "created_at": "2026-12-02T03:24:56.169Z",
  "updated_at": "2026-12-02T03:24:56.169Z",
  "published_at": "2026-12-02T03:24:56.169Z",
  "source": {
    "html": "<form class=\"signin\" novalidate onsubmit=\"event.preventDefault()\">\n  <h1 class=\"signin__title\">Welcome back</h1>\n  <p class=\"signin__sub\">Sign in to continue to your workspace.</p>\n\n  <div class=\"signin__social\">\n    <button type=\"button\"><svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"currentColor\" aria-hidden=\"true\"><path d=\"M12 .5a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2c-3.3.7-4-1.6-4-1.6-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2.1 1.8 1.2 1.8 1.2 1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.7-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.3.5-2.4 1.2-3.2-.1-.3-.5-1.5.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0C17.3 4.7 18.3 5 18.3 5c.7 1.7.3 2.9.1 3.2.8.8 1.2 1.9 1.2 3.2 0 4.6-2.8 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 .5z\"/></svg>GitHub</button>\n    <button type=\"button\"><svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" aria-hidden=\"true\"><path fill=\"#4285F4\" d=\"M23.5 12.3c0-.8-.1-1.6-.2-2.3H12v4.4h6.5a5.6 5.6 0 0 1-2.4 3.6v3h3.9c2.2-2.1 3.5-5.1 3.5-8.7z\"/><path fill=\"#34A853\" d=\"M12 24c3.2 0 6-1.1 8-2.9l-3.9-3c-1.1.7-2.5 1.2-4.1 1.2-3.1 0-5.8-2.1-6.7-5H1.3v3.1A12 12 0 0 0 12 24z\"/><path fill=\"#FBBC05\" d=\"M5.3 14.3a7.2 7.2 0 0 1 0-4.6V6.6H1.3a12 12 0 0 0 0 10.8z\"/><path fill=\"#EA4335\" d=\"M12 4.8c1.8 0 3.3.6 4.6 1.8l3.4-3.4A12 12 0 0 0 1.3 6.6l4 3.1c.9-2.8 3.6-4.9 6.7-4.9z\"/></svg>Google</button>\n  </div>\n\n  <p class=\"signin__divider\"><span>or</span></p>\n\n  <label class=\"signin__field\">\n    <span>Email</span>\n    <input type=\"email\" name=\"email\" autocomplete=\"email\" required placeholder=\"you@company.com\">\n    <small>Enter a valid email address.</small>\n  </label>\n\n  <label class=\"signin__field\">\n    <span>Password <a href=\"#\">Forgot?</a></span>\n    <span class=\"signin__password\">\n      <input type=\"password\" name=\"password\" autocomplete=\"current-password\" minlength=\"8\" required>\n      <button class=\"signin__reveal\" type=\"button\" aria-pressed=\"false\" aria-label=\"Show password\">Show</button>\n    </span>\n    <small>At least 8 characters.</small>\n  </label>\n\n  <button class=\"signin__submit\" type=\"submit\">Sign in</button>\n</form>",
    "css": "body {\n  margin: 0;\n  min-height: 100vh;\n  display: grid;\n  place-items: center;\n  background: #f3f2ee;\n  color: #17181c;\n  font: 14px/1.45 system-ui, sans-serif;\n}\n\n.signin {\n  display: grid;\n  gap: 14px;\n  width: min(340px, 100% - 32px);\n  padding: 28px;\n  border: 1px solid #e3e0d9;\n  border-radius: 18px;\n  background: #fff;\n  box-shadow: 0 24px 50px -30px rgb(0 0 0 / 0.3);\n}\n\n.signin__title {\n  margin: 0;\n  font-size: 1.35rem;\n  letter-spacing: -0.02em;\n}\n\n.signin__sub {\n  margin: -8px 0 4px;\n  color: #6c6f78;\n}\n\n.signin__social {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 8px;\n}\n\n.signin__social button,\n.signin__submit {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 8px;\n  padding: 0.65em;\n  border: 1px solid #dcd9d1;\n  border-radius: 10px;\n  background: #fff;\n  color: inherit;\n  font: inherit;\n  font-weight: 600;\n  cursor: pointer;\n}\n\n.signin__social button:hover {\n  background: #f7f6f3;\n}\n\n.signin__divider {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  margin: 0;\n  color: #9a9ca4;\n  font-size: 0.8rem;\n}\n\n.signin__divider::before,\n.signin__divider::after {\n  content: \"\";\n  flex: 1;\n  height: 1px;\n  background: #e6e3dd;\n}\n\n.signin__field {\n  display: grid;\n  gap: 6px;\n}\n\n.signin__field > span:first-child {\n  display: flex;\n  justify-content: space-between;\n  font-weight: 600;\n}\n\n.signin__field a {\n  color: #6c6f78;\n  font-weight: 400;\n}\n\n.signin__field input {\n  box-sizing: border-box;\n  width: 100%;\n  padding: 0.65em 0.8em;\n  border: 1px solid #d6d3cb;\n  border-radius: 10px;\n  font: inherit;\n  outline: none;\n}\n\n.signin__field input:focus {\n  border-color: #17181c;\n  box-shadow: 0 0 0 3px #ecebe6;\n}\n\n.signin__field small {\n  display: none;\n  color: #b42318;\n}\n\n.signin__field input:user-invalid {\n  border-color: #b42318;\n}\n\n.signin__field:has(input:user-invalid) small {\n  display: block;\n}\n\n.signin__password {\n  position: relative;\n}\n\n.signin__reveal {\n  position: absolute;\n  top: 50%;\n  right: 6px;\n  padding: 4px 8px;\n  border: 0;\n  border-radius: 6px;\n  background: #f1f0ec;\n  color: #4b4e57;\n  font: inherit;\n  font-size: 0.78rem;\n  transform: translateY(-50%);\n  cursor: pointer;\n}\n\n.signin__submit {\n  margin-top: 4px;\n  border-color: #17181c;\n  background: #17181c;\n  color: #fff;\n}\n\n.signin button:focus-visible {\n  outline: 2px solid #17181c;\n  outline-offset: 2px;\n}",
    "js": "const reveal = document.querySelector(\".signin__reveal\");\nconst password = document.querySelector('input[name=\"password\"]');\nreveal.addEventListener(\"click\", () => {\n  const shown = reveal.getAttribute(\"aria-pressed\") === \"true\";\n  password.type = shown ? \"password\" : \"text\";\n  reveal.setAttribute(\"aria-pressed\", String(!shown));\n  reveal.textContent = shown ? \"Show\" : \"Hide\";\n  reveal.setAttribute(\"aria-label\", shown ? \"Show password\" : \"Hide password\");\n});"
  }
}