Skip to content

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.

3 min readENFRNLDE
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.

PackageVersionWhat it's forAbout
motion14.6.0Animation: transitions, gestures and layout animation, from motion/react47 KB for motion and AnimatePresence, 60 KB in all
lucide-react1.61.0Icons as React components2 KB per icon
clsx2.1.1Building className strings from conditionsunder 1 KB
date-fns4.4.0Formatting and calculating dates6 KB for format, 18 KB in all
zod4.6.7Checking the shape of data, such as form input92 KB; zod/mini 4 KB
embla-carousel-react8.6.0Carousels and sliders you can swipe8 KB
@use-gesture/react10.3.1Drag, pinch, scroll and hover gestures9 KB
canvas-confetti1.9.4Confetti bursts4 KB
recharts3.10.1Charts: line, bar, area, pie and more104 KB for a line chart, 160 KB in all
three0.186.13D graphics in WebGL131 KB for a simple scene, 188 KB in all
@react-three/fiber9.8.2three as React components250 KB, three included
@react-three/drei10.7.9Ready-made parts for @react-three/fiber: camera controls, text, shapes116 KB for OrbitControls, three included; import only the parts you use
@floating-ui/react0.27.20Placing tooltips, popovers and menus next to what they belong to7 KB for placement, 32 KB in all
prism-react-renderer2.4.1Code samples with syntax colouring26 KB
qrcode1.5.4QR codes, made in the page10 KB
matter-js0.20.02D physics effects: falling, bouncing, colliding shapes27 KB
culori4.0.2Colour maths: converting, mixing and checking contrast15 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.