Prerequisites
Before installing Paste, ensure your project meets these requirements:- React: Version 17.0.2, 18.x, or 19.x
- React DOM: Version 17.0.2, 18.x, or 19.x
- Node.js: Version 16 or higher
- TypeScript (optional): Version 4.9.4 or higher
Installation Options
Paste can be installed using npm, yarn, or pnpm.What Gets Installed
The@twilio-paste/core package includes:
- All Paste components (buttons, inputs, modals, etc.)
- Design tokens
- Theme provider and theming utilities
- Customization provider
- TypeScript type definitions
@twilio-paste/icons package includes:
- Comprehensive icon library
- Icon components for use in your application
Peer Dependencies
Paste requires the following peer dependencies. Most projects already have these installed:Peer Dependency Versions
From@twilio-paste/core package.json:
The @types packages are only needed if you’re using TypeScript.
Installing Individual Packages
For more control over your bundle size, you can install individual Paste packages:Core Packages
Individual Components
TypeScript Configuration
If you’re using TypeScript, Paste works out of the box with no additional configuration. Type definitions are included with each package.Recommended tsconfig.json Settings
Package Manager Configurations
Using with npm
No special configuration required. Just install and use:Using with Yarn
For Yarn v2+ (Berry), add to.yarnrc.yml if you encounter peer dependency warnings:
Using with pnpm
Add to.npmrc to handle peer dependencies:
Bundler Configuration
Webpack
Paste works with Webpack out of the box. For optimal tree-shaking:Vite
Paste works perfectly with Vite:Next.js
For Next.js, no special configuration is needed. Just install and import:Create React App
Create React App works with Paste without any configuration:Troubleshooting
Peer Dependency Warnings
If you see peer dependency warnings during installation:- Check your React version: Paste requires React 17.0.2 or higher
- Install missing peers: Install @types/react and @types/react-dom if using TypeScript
- Use —legacy-peer-deps: For npm 7+, use
npm install --legacy-peer-depsif needed
Module Not Found Errors
If you get “Module not found” errors:TypeScript Errors
If you encounter TypeScript errors:- Ensure @types packages are installed: Install @types/react and @types/react-dom
- Check TypeScript version: Use TypeScript 4.9.4 or higher
- Restart your TS server: In VS Code, run “TypeScript: Restart TS Server”
Build Size Issues
If your bundle size is larger than expected:- Use individual imports: Import from specific paths like
@twilio-paste/core/button - Enable tree-shaking: Ensure your bundler has tree-shaking enabled
- Check your imports: Avoid importing from
@twilio-paste/coredirectly