Search
weatherDashboard
@jrgeminem
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function WeatherDashboard() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<WeatherDashboard />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
zod_demo_frontend
@stevekrouse
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import type { User } from "./zod_demo_shared";
const [serverResponse, setServerResponse] = useState<string>("");
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const { name, value } = e.target;
setUser(prev => ({ ...prev, [name]: name === "age" ? parseInt(value) || 0 : value }));
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
admirableTomatoLimpet
@Its_nasim_ch
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useState } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
const SALON_SERVICES = [
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
scientificCalculatorApp
@Adool55
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useState } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function ScientificCalculator() {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
oliveGardenChar
@charmaine
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useState, useRef } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const handleTouchStart = (e) => {
setStartX(e.touches[0].clientX);
const handleTouchMove = (e) => {
if (startX === null) return;
const currentX = e.touches[0].clientX;
const diff = startX - currentX;
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
iframeGridInfinite
@maxm
* This val creates an infinite grid of iframes with thick draggable borders.
* It includes a welcome modal, fixes the drag state issue, and stores iframe URLs in a database.
HTTP
* It includes a welcome modal, fixes the drag state issue, and stores iframe URLs in a database.
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect, useRef } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function Modal({ onClose }) {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
async function handleSubmitUrl(request: Request): Promise<Response> {
ragwithclaude_ui
@yawnxyz
Wanted to build a UI for Simon's thing but he locked it lol
HTTP
// rag with claude ui
// https://simonw-ragwithclaude.web.val.run/?question=what%20is%20shot%20scraper
import { renderToString } from "npm:react-dom/server";
import { jsx } from "https://deno.land/x/hono@v3.11.7/middleware.ts";
import { Hono } from "https://deno.land/x/hono@v3.11.7/mod.ts";
jsonToDalleForm
@weaverwhale
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import OpenAI from "https://esm.sh/openai";
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { systemPrompt } from "https://esm.town/v/weaverwhale/jtdPrompt";
margin-top: 20px;
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
headers: { "Content-Type": "application/json" },
// Prepare the HTML with the React root element
const html = `
sampleVanIsland
@reosablo
simple App component made with VanJS This script is not for execution but for import for SSR + hydration. See https://www.val.town/v/reosablo/sampleVanSSR
Script
import type { VanObj } from "npm:mini-van-plate@0.5.6/shared";
const fromClient = typeof document !== "undefined";
/** root DOM id of App component for hydration */
// disable the button if we're not in the browser
const disabled = van.derive(() => !fromClient || generating.val);
const uuidsDom = ul();
form(
{ onsubmit: fromClient && handleSubmit },
label(
// hydrate App component if we're in the browser
// usually, this is done in `client.ts` script
if (fromClient) {
const { default: van } = await import("https://esm.sh/v135/vanjs-core@1.5.0");
htmxCounterExample
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
HTTP
/** @jsx jsx **/
/** @jsx jsx */
import { renderToString } from "npm:react-dom/server";
import { jsx } from "https://deno.land/x/hono@v3.11.7/middleware.ts";
import { Hono } from "https://deno.land/x/hono@v3.11.7/mod.ts";
savvyPurpleSpoonbill
@all
@jsxImportSource https://esm.sh/react
HTTP
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import { tomorrow } from "https://esm.sh/react-syntax-highlighter/dist/esm/styles/prism";
async function handleSubmit(e: React.FormEvent) {
function client() {
client();
const client = new Cerebras();
const completion = await client.chat.completions.create({
youthfulLavenderMosquito
@yuhbuh505
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
import React, { useRef, useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
class BubbleShooterGame {
this.canvas.addEventListener('mousemove', (e) => {
const rect = this.canvas.getBoundingClientRect();
this.mouseX = e.clientX - rect.left;
this.mouseY = e.clientY - rect.top;
this.canvas.addEventListener('click', () => {
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
cerebras_coder
@swethard
This is an AI code assistant powered by Cerebras , running llama3.3-70b. Inspired by Hassan's Llama Coder . Setup Sign up for Cerebras Get a Cerebras API Key Save it in a Val Town environment variable called CEREBRAS_API_KEY Todos I'm looking for collaborators to help. Fork & send me PRs! [ ] Experiment with two prompt chain (started here )
HTTP
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import Cerebras from "https://esm.sh/@cerebras/cerebras_cloud_sdk";
import { Prism as SyntaxHighlighter } from "https://esm.sh/react-syntax-highlighter";
import { STARTER_PROMPTS } from "https://esm.town/v/stevekrouse/cerebras_coder_prompts";
} else {
const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
const completion = await client.chat.completions.create({
messages: [
const [iframeKey, setIframeKey] = useState(0);
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
promptGen
@all
* This val creates a website that generates optimized prompts for Val Town based on user input.
* It uses the OpenAI API to generate prompts and incorporates a loading animation.
* The generated prompt is tailored to Val Town's specific features and best practices.
HTTP
* The generated prompt is tailored to Val Town's specific features and best practices.
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
const valTownFeatures = [
"OpenAI integration",
"React support",
"TypeScript support",
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") {
client();
async function server(request: Request): Promise<Response> {
server
@stevekrouse
tldraw example with builder, for consistent React versions.
HTTP
tldraw example with builder, for consistent React versions.
/** @jsxImportSource https://esm.sh/react */
import React, { useState, useEffect } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
import { Tldraw } from "https://esm.sh/@tldraw/tldraw@2.3.0";
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export const server = (req) =>