CLI
UI5 Web Components provides command-line tools for scaffolding projects and generating components.
Create a New Projectโ
Scaffold a fully configured UI5 Web Components package with a single command:
npm create @ui5/webcomponents-package
This launches an interactive wizard that sets up a ready-to-run TypeScript project with a sample component, theming, i18n, and a dev server.
Optionsโ
Examplesโ
Non-interactive with a custom name
npm create @ui5/webcomponents-package -- \
--name "my-components" \
--skip
Scoped package with Cypress testing
npm create @ui5/webcomponents-package -- \
--name "@scope/my-lib" \
--testSetup "cypress" \
--skip
What Gets Generatedโ
The scaffolded project includes:
- A sample web component (
MyFirstComponent) with a template, styles, and i18n - Dev server with hot reload (
npm start) - Build pipeline for production (
npm run build) - TypeScript configuration
- Cypress test setup (if selected)
- ESLint configuration
- Theming infrastructure (SAP Horizon)
After the project is created:
cd my-package
npm install
npm start
Generate a Componentโ
Inside a scaffolded project, generate a new web component:
npm run create-ui5-element
This prompts for a PascalCase component name (e.g., MyButton) and generates three files:
The tag name is derived automatically โ MyButton becomes my-my-button (using the prefix from .env).
You can also pass the name directly:
npm run create-ui5-element "MyButton"
After generating, import the component in src/bundle.esm.ts:
import "./MyButton.js";
Project Commandsโ
Every scaffolded project comes with these commands: