MCPcopy Create free account
hub / github.com/TanStack/query / render

Method render

examples/lit/chat/src/main.ts:38–96  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 }
37
38 render() {
39 return html`
40 <chat-query-provider>
41 <div class="flex flex-col h-screen max-w-3xl mx-auto p-4">
42 <h1 class="text-3xl font-bold text-gray-800">
43 TanStack Chat Example
44 </h1>
45 <div class="overflow-y-auto mb-4 space-y-4">
46 ${repeat(
47 this.questions,
48 ({ id }) => id,
49 ({ id, question }) =>
50 html`<chat-message
51 .messageId=${id}
52 .question=${question}
53 ></chat-message>`,
54 )}
55 </div>
56 <form
57 class="flex items-center space-x-2"
58 @submit=${this.submitMessage}
59 >
60 <input
61 .value=${this.currentQuestion}
62 class="flex-1 p-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:ring-offset-gray-100"
63 placeholder="Type your message..."
64 @input=${(event: Event) =>
65 (this.currentQuestion = (
66 event.currentTarget as HTMLInputElement
67 ).value)}
68 />
69 <button
70 type="submit"
71 ?disabled=${!this.currentQuestion.trim()}
72 class="flex items-center gap-2 bg-blue-600 hover:bg-blue-700 text-white font-semibold px-4 py-2 rounded-2xl shadow-md transition"
73 >
74 <span>Send</span>
75 <svg
76 xmlns="http://www.w3.org/2000/svg"
77 width="24"
78 height="24"
79 viewBox="0 0 24 24"
80 fill="none"
81 stroke="currentColor"
82 stroke-width="2"
83 stroke-linecap="round"
84 stroke-linejoin="round"
85 >
86 <path
87 d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"
88 />
89 <path d="m21.854 2.147-10.94 10.939" />
90 </svg>
91 </button>
92 </form>
93 </div>
94 </chat-query-provider>
95 `

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected