Skip to content

Build your personal knowledge base with Trilium Notes

feat(llm): reshape the chat composer into a rounded island

Elian Doran8bdc77ccb82a
diff --git a/apps/client/src/widgets/sidebar/SidebarChat.css b/apps/client/src/widgets/sidebar/SidebarChat.css
index c6f6594f4d..e38c765aba 100644
--- a/apps/client/src/widgets/sidebar/SidebarChat.css
+++ b/apps/client/src/widgets/sidebar/SidebarChat.css
@@ -8,11 +8,12 @@
overflow: hidden; /* Contain children within available space */
}
-.sidebar-chat-container .llm-chat-input-form {
+/* The composer island carries its own padding; the gap to the sidebar edges is a margin. */
+.sidebar-chat-container .llm-chat-input-form,
+.sidebar-chat-container .llm-chat-no-provider {
flex-shrink: 0;
- padding: 8px;
+ margin: 0 8px 8px;
font-size: 0.9em;
- min-height: 40px;
}
/* Scroll-container essentials (flex/min-height/overflow) come from .chat-message-list. */
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.css b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.css
index c6778e2cdc..9da2754f14 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.css
@@ -1,10 +1,33 @@
-/* Input form */
+/*
+ * The composer "island": one rounded surface holding the attachment strip, the
+ * text editor and the control row. Everything inside is deliberately de-boxed —
+ * no borders or backgrounds of its own — so the whole thing reads as a single
+ * control rather than a stack of nested boxes. Outer spacing is a margin applied
+ * by the host (LlmChat.css / SidebarChat.css), since the padding here is the
+ * island's own inner padding.
+ */
.llm-chat-input-form {
display: flex;
flex-direction: column;
- gap: 0.5rem;
- padding-top: 1rem;
- border-top: 1px solid var(--main-border-color);
+ gap: 0.375rem;
+ padding: 0.5rem;
+ /* The theme's card recipe, as `.options-section-card` uses it, at the 10px radius
+ shared by the center pane, dropdown menus and tool dialogs. Both themes set
+ `--card-box-shadow: none` — a Trilium surface is defined by its fill, not a shadow. */
+ border: 1px solid var(--card-border-color, var(--main-border-color));
+ border-radius: 10px;
+ background: var(--card-background-color, var(--accented-background-color));
+ box-shadow: var(--card-box-shadow, none);
+ outline: 2px solid transparent;
+ transition: outline-color 100ms linear;
+}
+
+/* Focus lives on the island, not on the editor inside it. Keyed off CKEditor's own
+ `.ck-focused` rather than `:focus-within` so tabbing to the model picker or the
+ send button doesn't light up the whole card. Uses the same 2px focus outline the
+ theme gives icon buttons and dialog buttons. */
+.llm-chat-input-form:has(.llm-chat-input.ck-focused) {
+ outline-color: var(--input-focus-outline-color, var(--muted-text-color));
}
/* Attachment preview row above the editor */
@@ -12,6 +35,7 @@
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
+ padding: 0.125rem 0.125rem 0;
}
.llm-chat-attachment-chip {
@@ -87,23 +111,25 @@
cursor: not-allowed;
}
-.llm-chat-attach-btn {
- font-size: 1.1rem;
-}
-
+/*
+ * The editor. Stripped of its own chrome so the island owns the border, the
+ * background and the focus ring. The `!important`s override CKEditor's bundled
+ * inline-editable styling, which lands at equal specificity from a stylesheet
+ * whose load order relative to this file isn't guaranteed.
+ */
.llm-chat-input {
flex: 1;
- min-height: 60px;
+ min-height: 46px;
max-height: 200px;
overflow-y: auto;
- padding: 0.5rem !important;
- border: 1px solid var(--main-border-color) !important;
- border-radius: 4px !important;
+ padding: 0.25rem 0.375rem !important;
+ border: none !important;
+ border-radius: 0 !important;
+ box-shadow: none !important;
+ background: transparent;
+ color: var(--main-text-color);
font-family: inherit;
font-size: inherit;
- background: var(--main-background-color);
- color: var(--main-text-color);
- transition: border-color 0.1s linear, box-shadow 0.1s linear;
}
/* CKEditor adds .ck-content / .ck-focused to the same element it took over. */
@@ -123,56 +149,50 @@
}
}
-.llm-chat-input.ck-focused {
- border-color: var(--main-selection-color);
- box-shadow: 0 0 0 2px var(--main-selection-color-soft, rgba(0, 123, 255, 0.25));
-}
-
.llm-chat-input.ck-read-only {
opacity: 0.6;
cursor: not-allowed;
}
.llm-chat-input.ck-content .mention {
- color: var(--main-selection-color, #007bff);
+ color: var(--link-color, #007bff);
background: transparent;
}
-/* Options row */
+/* Control row, inside the island */
.llm-chat-options {
display: flex;
align-items: center;
- gap: 0.75rem;
-}
-
-.llm-chat-send-btn {
- margin-left: auto;
- font-size: 1.25rem;
-}
-
-.llm-chat-send-btn.disabled {
- opacity: 0.4;
-}
-
-.llm-chat-stop-btn {
- color: var(--danger-color, #dc3545);
+ gap: 0.25rem;
}
/* Model selector */
.llm-chat-model-selector {
display: flex;
align-items: center;
- gap: 0.375rem;
+ gap: 0.25rem;
+ /* Owns the spacer, so the trailing action buttons flow right without either of
+ them needing an `auto` margin of its own. */
+ margin-inline-end: auto;
+ min-width: 0;
font-size: 0.85rem;
color: var(--muted-text-color);
}
-.llm-chat-model-selector .bx {
+.llm-chat-model-selector .dropdown {
+ display: flex;
+ min-width: 0;
+}
+
+.llm-chat-model-select-icon {
font-size: 1rem;
+ flex-shrink: 0;
}
-.llm-chat-model-selector .dropdown {
- display: flex;
+.llm-chat-model-select-name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
}
/* Scoped to the dropdown wrapper (not `.llm-chat-model-selector`) so these menu styles
@@ -193,25 +213,26 @@
top: auto;
}
-.llm-chat-model-select.select-button {
- padding: 0.25rem 0.5rem;
- border: 1px solid var(--main-border-color);
- border-radius: 4px;
- background: var(--main-background-color);
- color: var(--main-text-color);
+/*
+ * The model picker is left as the theme's own combo box (`.select-button.dropdown-toggle.btn`
+ * — its fill, its 6px radius, its caret, its focus outline), so it reads as the same
+ * control as every other Trilium selector. Only what the theme can't know is set here:
+ * the model name has to ellipsize rather than stretch the row, and the leading chip icon
+ * needs the button to lay its content out as a flex row. Matching the theme's selector
+ * verbatim keeps these at a specificity that actually wins.
+ */
+.llm-chat-input-form .llm-chat-model-select.select-button.dropdown-toggle.btn {
+ display: flex;
+ align-items: center;
+ gap: 0.35rem;
+ min-width: 0;
+ max-width: 15rem;
font-family: inherit;
font-size: 0.85rem;
- cursor: pointer;
- min-width: 140px;
- text-align: left;
-}
-
-.llm-chat-model-select.select-button:focus {
- outline: none;
- border-color: var(--main-selection-color);
+ text-align: start;
}
-.llm-chat-model-select.select-button:disabled {
+.llm-chat-input-form .llm-chat-model-select.select-button.dropdown-toggle.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
@@ -233,7 +254,7 @@
.llm-chat-note-context.tn-low-profile:hover:not(:disabled) {
opacity: 0.8;
- background: none;
+ background: var(--hover-item-background-color, var(--accented-background-color));
}
.llm-chat-note-context.tn-low-profile.active {
@@ -245,7 +266,7 @@
display: flex;
align-items: center;
gap: 0.375rem;
- margin-left: 0.5rem;
+ margin-left: 0.25rem;
cursor: help;
}
@@ -261,13 +282,62 @@
color: var(--muted-text-color);
}
-/* No provider state */
+/*
+ * Trailing actions. Both are sized through the theme's `--icon-button-*` knobs
+ * rather than by overriding width/border, which the theme locks with `!important`.
+ */
+.llm-chat-input-form .llm-chat-attach-btn.icon-action {
+ --icon-button-size: 30px;
+ --icon-button-icon-ratio: 0.6;
+}
+
+/* Filled circular send — the one primary affordance in the island. Monochrome
+ (text color on background color) rather than an accent, because no theme here
+ defines a brand accent variable. */
+.llm-chat-input-form .llm-chat-send-btn.icon-action {
+ --icon-button-size: 32px;
+ --icon-button-icon-ratio: 0.55;
+ --icon-button-color: var(--main-background-color);
+ --icon-button-hover-color: var(--main-background-color);
+ --icon-button-hover-background: var(--main-text-color);
+
+ border-radius: 50%;
+ background: var(--main-text-color);
+}
+
+.llm-chat-input-form .llm-chat-send-btn.icon-action:hover:not(.disabled) {
+ opacity: 0.85;
+}
+
+.llm-chat-input-form .llm-chat-send-btn.icon-action.disabled {
+ --icon-button-color: var(--muted-text-color);
+
+ background: var(--accented-background-color);
+ opacity: 1;
+}
+
+.llm-chat-input-form .llm-chat-send-btn.icon-action.disabled::before {
+ opacity: 1;
+}
+
+.llm-chat-input-form .llm-chat-send-btn.llm-chat-stop-btn.icon-action {
+ --icon-button-color: #fff;
+ --icon-button-hover-color: #fff;
+ --icon-button-hover-background: var(--danger-color, #dc3545);
+
+ background: var(--danger-color, #dc3545);
+}
+
+/* No provider state — same island, standing in for the composer */
.llm-chat-no-provider {
display: flex;
align-items: center;
justify-content: center;
- padding: 1rem;
- border-top: 1px solid var(--main-border-color);
+ padding: 1.25rem 1rem;
+ border: 1px solid var(--card-border-color, var(--main-border-color));
+ border-radius: 10px;
+ background: var(--card-background-color, var(--accented-background-color));
+ box-shadow: var(--card-box-shadow, none);
}
.llm-chat-no-provider-content {
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
index d35056d69c..8efb031619 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
+++ b/apps/client/src/widgets/type_widgets/llm_chat/ChatInputBar.tsx
@@ -214,7 +214,10 @@ export default function ChatInputBar({
const percentage = Math.min((chat.lastPromptTokens / contextWindow) * 100, 100);
const isWarning = percentage > 75;
const isCritical = percentage > 90;
- const pieColor = isCritical ? "var(--danger-color, #d9534f)" : isWarning ? "var(--warning-color, #f0ad4e)" : "var(--main-selection-color, #007bff)";
+ // `--main-selection-color` is not defined by any Trilium theme, so the nominal
+ // colour here was always the hardcoded fallback; `--link-color` is the real
+ // theme-aware accent.
+ const pieColor = isCritical ? "var(--danger-color, #d9534f)" : isWarning ? "var(--warning-color, #f0ad4e)" : "var(--link-color, #007bff)";
// Show setup prompt if no provider is configured
if (!chat.isCheckingProvider && !chat.hasProvider) {
@@ -362,11 +365,15 @@ export default function ChatInputBar({
/>
<div className="llm-chat-options">
<div className="llm-chat-model-selector">
- <span className="bx bx-chip" />
<Dropdown
- text={currentModel
- ? <>{currentModel.name}</>
- : <span className="llm-chat-model-placeholder">{t("llm_chat.no_model_selected")}</span>}
+ // The chip icon lives inside the toggle so it shares the pill's
+ // hover surface instead of floating loose next to it.
+ text={<>
+ <span className="bx bx-chip llm-chat-model-select-icon" />
+ {currentModel
+ ? <span className="llm-chat-model-select-name">{currentModel.name}</span>
+ : <span className="llm-chat-model-select-name llm-chat-model-placeholder">{t("llm_chat.no_model_selected")}</span>}
+ </>}
disabled={chat.isStreaming}
buttonClassName="llm-chat-model-select"
className="llm-chat-model-dropdown"
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css b/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
index b429ada78d..52cf5790ea 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/LlmChat.css
@@ -8,7 +8,10 @@
padding: 1em;
}
- .llm-chat-input-form {
- padding: 0.5em 1em;
+ /* The composer is an island with its own inner padding, so the gap to the
+ timeline and the pane edges is a margin here rather than padding there. */
+ .llm-chat-input-form,
+ .llm-chat-no-provider {
+ margin: 0 1em 0.75em;
}
}