diff --git a/examples/website/src/index.html b/examples/website/src/index.html
index 7c3cb56..6cc3ed3 100644
--- a/examples/website/src/index.html
+++ b/examples/website/src/index.html
@@ -145,31 +145,36 @@
+ Original
+ Click to edit
+
diff --git a/examples/website/src/index.ts b/examples/website/src/index.ts
index 33c992d..bf6ebdb 100644
--- a/examples/website/src/index.ts
+++ b/examples/website/src/index.ts
@@ -225,7 +225,8 @@ function resizeTextAreas(): void {
function autoResize(textarea: HTMLTextAreaElement): void {
textarea.style.height = 'auto';
- textarea.style.height = textarea.scrollHeight + 'px';
+ const borderHeight = textarea.offsetHeight - textarea.clientHeight;
+ textarea.style.height = textarea.scrollHeight + borderHeight + 'px';
}
main().catch((error) => {
diff --git a/examples/website/src/style.scss b/examples/website/src/style.scss
index 568a423..9cc7684 100644
--- a/examples/website/src/style.scss
+++ b/examples/website/src/style.scss
@@ -272,6 +272,22 @@ label {
cursor: help;
}
+.input-label {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ width: 100%;
+ cursor: text;
+}
+
+.edit-hint {
+ color: $text-secondary;
+ font-size: 0.75rem;
+ font-weight: 400;
+ white-space: nowrap;
+}
+
.box {
width: 1ch;
height: 1ch;
@@ -283,18 +299,39 @@ label {
textarea {
width: 100%;
- border: none;
+ border: 1px solid $border-grey;
+ border-radius: 6px;
+ padding: 8px 10px;
+ background: $light-bg;
font-size: 1rem;
font-family: inherit;
color: $text-primary;
box-sizing: border-box;
resize: none;
- outline: none;
+ cursor: text;
+ user-select: text;
+ caret-color: $primary-blue;
+ outline: 2px solid transparent;
+ outline-offset: 2px;
+ transition:
+ border-color 0.15s,
+ background-color 0.15s,
+ outline-color 0.15s;
margin-bottom: 0;
field-sizing: content;
/* Doesn't work in Safari yet */
}
+textarea:hover {
+ border-color: $primary-blue;
+}
+
+textarea:focus {
+ border-color: $primary-blue;
+ background: $white;
+ outline-color: selection-colour($primary-blue, 0.3);
+}
+
#merged {
width: 100%;
user-select: text;