Skip to content

Commit 0cac136

Browse files
iamdavidhillHona
authored andcommitted
tui: improve tool display layout to prevent text overflow and add dedicated action wrapper
1 parent d555c67 commit 0cac136

3 files changed

Lines changed: 20 additions & 9 deletions

File tree

packages/ui/src/components/basic-tool.css

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
justify-content: flex-start;
99

1010
[data-slot="basic-tool-tool-trigger-content"] {
11-
flex: 1 1 auto;
12-
width: 100%;
11+
flex: 0 1 auto;
12+
width: auto;
13+
max-width: calc(100% - 24px);
1314
min-width: 0;
1415
display: flex;
1516
align-items: center;
@@ -51,19 +52,21 @@
5152
}
5253

5354
[data-slot="basic-tool-tool-info"] {
54-
flex: 1 1 auto;
55+
flex: 0 1 auto;
5556
min-width: 0;
57+
max-width: 100%;
5658
font-size: 14px;
5759
}
5860

5961
[data-slot="basic-tool-tool-info-structured"] {
60-
flex: 1 1 auto;
61-
width: 100%;
62+
flex: 0 1 auto;
63+
width: auto;
64+
max-width: 100%;
6265
min-width: 0;
63-
display: flex;
66+
display: inline-flex;
6467
align-items: center;
6568
gap: 8px;
66-
justify-content: space-between;
69+
justify-content: flex-start;
6770
}
6871

6972
[data-slot="basic-tool-tool-info-main"] {
@@ -155,4 +158,10 @@
155158
letter-spacing: var(--letter-spacing-normal);
156159
color: var(--text-base);
157160
}
161+
162+
[data-slot="basic-tool-tool-action"] {
163+
display: inline-flex;
164+
align-items: center;
165+
flex-shrink: 0;
166+
}
158167
}

packages/ui/src/components/basic-tool.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ export function BasicTool(props: BasicToolProps) {
174174
</Show>
175175
</Show>
176176
</div>
177-
<Show when={!pending() && trigger().action}>{trigger().action}</Show>
177+
<Show when={!pending() && trigger().action}>
178+
<span data-slot="basic-tool-tool-action">{trigger().action}</span>
179+
</Show>
178180
</div>
179181
)}
180182
</Match>

packages/ui/src/components/message-part.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@
424424
display: flex;
425425
align-items: center;
426426
justify-content: space-between;
427-
gap: 8px;
427+
gap: 12px;
428428
width: 100%;
429429

430430
[data-slot="message-part-title-area"] {

0 commit comments

Comments
 (0)