Packages you can use in code components
The npm packages a code component can import, what each is for and about how much it adds, and the rules they follow.
On this page 3 sections
A code component can import React, @xeek/code and its own files, and the packages below. Import one as you would in
any React project, for example import { motion } from 'motion/react'. The code editor offers them as you type an
import.
Each package is fixed to the version in the table. When you save a component, the package is built into it from our own copy, so nothing is downloaded from npm or a CDN, then or when your site loads.
The packages
Sizes are about what a component adds when it imports the package, compressed, with React left out because your page already has it. A component carries only the parts it imports. For the big packages, the first figure is a typical use and the second the whole package.
| Package | Version | What it's for | About |
|---|---|---|---|
motion | 14.6.0 | Animation: transitions, gestures and layout animation, from motion/react | 47 KB for motion and AnimatePresence, 60 KB in all |
lucide-react | 1.61.0 | Icons as React components | 2 KB per icon |
clsx | 2.1.1 | Building className strings from conditions | under 1 KB |
date-fns | 4.4.0 | Formatting and calculating dates | 6 KB for format, 18 KB in all |
zod | 4.6.7 | Checking the shape of data, such as form input | 92 KB; zod/mini 4 KB |
embla-carousel-react | 8.6.0 | Carousels and sliders you can swipe | 8 KB |
@use-gesture/react | 10.3.1 | Drag, pinch, scroll and hover gestures | 9 KB |
canvas-confetti | 1.9.4 | Confetti bursts | 4 KB |
recharts | 3.10.1 | Charts: line, bar, area, pie and more | 104 KB for a line chart, 160 KB in all |
three | 0.186.1 | 3D graphics in WebGL | 131 KB for a simple scene, 188 KB in all |
@react-three/fiber | 9.8.2 | three as React components | 250 KB, three included |
@react-three/drei | 10.7.9 | Ready-made parts for @react-three/fiber: camera controls, text, shapes | 116 KB for OrbitControls, three included; import only the parts you use |
@floating-ui/react | 0.27.20 | Placing tooltips, popovers and menus next to what they belong to | 7 KB for placement, 32 KB in all |
prism-react-renderer | 2.4.1 | Code samples with syntax colouring | 26 KB |
qrcode | 1.5.4 | QR codes, made in the page | 10 KB |
matter-js | 0.20.0 | 2D physics effects: falling, bouncing, colliding shapes | 27 KB |
culori | 4.0.2 | Colour maths: converting, mixing and checking contrast | 15 KB for a few functions, 23 KB in all |
A large component takes longer to load on a slow phone. If a section only needs a little movement or an icon, a smaller package, or a few lines of your own, does the same.
The rules
- Only these packages. Any other import stops the build with an error that names the import, and so does an
import from a web address or a part of Node.js. A path a package doesn't have, such as
three/no-such-file, does too. - No outside services. A component can't load code, fonts, models or images from another site. On the canvas a
code component has no network at all. Some parts of these packages fetch files from the internet when you use them,
such as the ready-made environments and the default font of
@react-three/drei's text: give them a file from your site's assets instead. - Code waits for consent. On a site that asks visitors for cookie consent, a code component runs only once the visitor allows its category: Marketing, unless you choose another for it in the site settings under Cookies and consent. Until then it shows as it was rendered when you published.
- Versions stay put. A saved version of your component keeps the package versions it was built with. When we move a package to a newer version, this list changes, and your component uses it once you save it again.
Request a package
Missing one? Ask for it with Contact support in the editor's Help, and say what you want to build. We add a package after checking its licence, its size and what it loads, so not every request makes the list.