Last 12 weeks · 4 commits
4 of 6 standards met
Fixes #439 While streaming with an handler, renders as , so the Enter guard in finds no and evaluates to : the form submits mid-stream. This applies the guard proposed in the issue: no submit button in the form blocks Enter, same as a disabled one. This also answers the behaviour question raised in the issue thread: a composable without no longer submits on Enter. The form has no submit control to consult, and submitting with unknown status is the unsafe default. Both behaviours are pinned in . All 952 package tests pass.
Memoized attachment rows re-rendered on each keystroke in provider-backed mode. The local attachments context made a new copy of each attachment object on each recompute, and each text change caused a recompute. Rows that compare attachments by reference, for example a chip, could not skip those renders. This change passes the array through by reference. Unchanged attachments keep their identity during text input, but rows still re-render when a file is added or removed. Two new tests make sure that references stay equal during text input and that a memoized chip re-renders only on file changes. The two tests are not successful before the change.
With , each keystroke removed the and listeners on the document or the form, and installed them again. The registration effect for the hidden file input also ran on each keystroke. After this change, the listeners attach one time for each mount, and text input does not touch them. The drop handlers call a wrapper, and the wrapper calls the latest closure. Thus the validation behavior for , , , and does not change. Five new tests spy on the document listeners and the form listeners during text input, and drop files after prop changes and count changes. Four of the five tests are not successful on the code before this change. The fifth test makes sure that a drop on the document adds the file. Evidence:
Adds a customizable prop to , allowing users to replace the default wrench icon with custom icons, either statically or dynamically based on tool name and state. Changes Adds prop to accepting a or a render function The render function receives — providing full tool context and default sizing/color styles via Extracts as a shared base type for both and Exports so consumers can type their icon render functions Falls back to the default when is not provided or returns Adds to the default icon className to prevent flex shrinking Testing Verified rendering in the docs dev server with custom SVG icons, name-based icon mapping, and fallback to default:
Repository: vercel/ai-elements. Description: AI Elements is a component library and custom registry built on top of shadcn/ui to help you build AI-native applications faster. Stars: 2313, Forks: 265. Primary language: TypeScript. Languages: TypeScript (87.8%), MDX (11.9%), CSS (0.2%), JavaScript (0.1%). Homepage: https://elements.ai-sdk.dev Topics: ai, elements, shadcn-ui, vercel. Latest release: ai-elements@1.9.0 (5mo ago). Open PRs: 53, open issues: 31. Last activity: 1w ago. Community health: 87%. Top contributors: haydenbleasel, dependabot[bot], tobiasbueschel, unclebay143, FranciscoMoretti, chaxus, Debbl, obadakhalili, smorimoto, vercel[bot] and others.