NV Elements Catalog Starters Repo System Themes About Getting Started Changelog Metrics Support Accessibility Contributions Requests Migration Deprecations Integrations Installation MCP CLI Lint Angular Bundles Extensions Go Hugo Import Maps Lit NextJS Nuxt Preact React SolidJS Svelte TypeScript Vue Foundations Typography Iconography Themes Design Tokens Size & Space Objects Interactions Support Status Color Animation Fonts Layers Custom Layout Horizontal Vertical Grid Popovers i18n Visualization View Transitions Elements Accordion Alert Avatar Badge Breadcrumb Button Button Group Card Chat Message Checkbox Color Combobox Copy Button Datagrid Integrations Column Action Column Alignment Column Fixed Column width Container Card Display Settings Footer Heatmap Keynav Multi Select Pagination Panel Detail Panel Grid Performance Placeholder Row Action Row Groups Row Sort Scroll Height Single Select Stripe Date Datetime Dialog Divider Dot Drawer Dropdown Dropdown Group Dropzone File Forms Validation Actions Control Icon Icon Button Input Input Group Logo Menu Month Notification Page Page Header Page Loader Pagination Panel Progressive Filter Chip Progress Bar Progress Ring Password Preferences Input Pulse Radio Range Resize Handle Search Select Skeleton Sort Button Sparkline Star Rating Steps Switch Tabs Tag Textarea Time Toast Toggletip Toolbar Tooltip Tree Week Patterns Authentication Browse Dashboard Editor Empty States Heatmap Keyboard Shortcut Logging Media Onboarding Panel Responsive Search Subheader Trend Code Codeblock Monaco Input Diff Input Editor Diff Editor Problems Markdown Markdown CSS Utility Labs Responsive Layout Viewport Container Patterns Forms API Design Properties & Attributes Slots Registration CustomEvents Stateless Composition Styles Packaging Glossary Logs Internal Guidelines Agent Harness Documentation Examples TypeScript Testing Unit Testing Accessibility Testing Lighthouse Testing SSR Testing Visual Testing Troubleshooting Component Creation Internal Examples All Examples

Component Creation

This guide covers creating new components in the Elements library with all required files and conventions.

File Structure

Every component requires 10 files following this naming pattern:


    

Component Class (component-name.ts)

Base Classes

Choose the appropriate base class:

  • BaseButton - For button-like interactive components
  • LitElement - For stateless or simple components

    

Required JSDoc Tags

  • @element - Component tag name
  • @description - What the component does
  • @since - Version when added (use 0.0.0 for new)
  • @entrypoint - Import path
  • @slot - Slot descriptions (required only when the component exposes one or more slots)
  • @cssprop - CSS custom properties
  • @aria - ARIA pattern reference (optional)

Metadata Object

Always include metadata with exact tag name and version:


    

Registration (define.ts)

Use the define() helper and declare global types:


    

Export (index.ts)

Export the component class without side effects:


    

Styles (component-name.css)

Use CSS custom properties for theming:


    

Examples (component-name.examples.ts)

Follow the examples guideline for naming and structure:


    

Test Files

Unit Tests (component-name.test.ts)

Follow the unit testing guideline:


    

Accessibility Tests (component-name.test.axe.ts)

Follow the accessibility testing guideline:


    

Visual Tests (component-name.test.visual.ts)

Follow the visual testing guideline:


    

SSR Tests (component-name.test.ssr.ts)

Follow the SSR testing guideline:


    

Lighthouse Tests (component-name.test.lighthouse.ts)

Follow the lighthouse testing guideline:


    

Checklist

When creating a new component, ensure:

  • [ ] All 10 files created with correct naming
  • [ ] Component class extends appropriate base class
  • [ ] JSDoc comments complete with all required tags
  • [ ] Metadata object includes tag and version
  • [ ] Properties use @property decorator with correct options
  • [ ] Properties that reflect use reflect: true
  • [ ] CSS custom properties defined and documented
  • [ ] Registration in define.ts with global type declaration
  • [ ] Examples follow naming conventions with @summary tags
  • [ ] All 5 test types implemented (unit, axe, visual, ssr, lighthouse)
  • [ ] Tests use proper fixture setup/cleanup patterns
  • [ ] TypeScript follows type safety guidelines

Reference Components

Study these complete examples:

  • /projects/core/src/button/ - BaseButton pattern, interactive component
  • /projects/core/src/badge/ - LitElement pattern, simple component
  • /projects/core/src/card/ - Composition pattern with slots