Skip to content

Conversation

@Artur-
Copy link
Member

@Artur- Artur- commented Dec 8, 2025

Add WEB_COMPONENT_GUIDELINES.md, a complete reference guide for creating new Vaadin web components. This document provides step-by-step instructions for component development following current repository patterns and best practices.

The guidelines cover:

Component Architecture:

  • Pure Lit pattern implementation (no legacy PolylitMixin)
  • Proper mixin chain ordering and usage
  • Component lifecycle management with Lit
  • Property definitions, event firing, and controllers

Theming System:

  • Lumo theme implementation (business-focused design)
  • Aura theme implementation (modern CSS with oklch, light-dark, relative colors)
  • Theme comparison and design token documentation
  • CSS custom properties and state attributes

Development Workflow:

  • Complete file structure for components
  • Package configuration and dependencies
  • TypeScript definitions for components and mixins
  • License headers and documentation requirements

Testing Requirements:

  • Unit tests for functionality, properties, events, and accessibility
  • DOM snapshot tests
  • Visual regression tests for Lumo, Aura, and base themes
  • TypeScript type tests
  • Keyboard interaction testing

Accessibility:

  • ARIA requirements and roles
  • Keyboard support patterns
  • Focus management
  • State attribute synchronization

Documentation:

  • JSDoc comment patterns
  • README structure
  • API documentation requirements

Common Patterns:

  • Interactive components (button-like)
  • Field components (input-like)
  • Overlay components (popup/dialog)
  • List/data components

This guide uses modern Lit patterns and supports both Vaadin themes (Lumo and Aura), ensuring consistency across the component library.

Add WEB_COMPONENT_GUIDELINES.md, a complete reference guide for creating new Vaadin web components. This document provides step-by-step instructions for component development following current repository patterns and best practices.

The guidelines cover:

Component Architecture:
- Pure Lit pattern implementation (no legacy PolylitMixin)
- Proper mixin chain ordering and usage
- Component lifecycle management with Lit
- Property definitions, event firing, and controllers

Theming System:
- Lumo theme implementation (business-focused design)
- Aura theme implementation (modern CSS with oklch, light-dark, relative colors)
- Theme comparison and design token documentation
- CSS custom properties and state attributes

Development Workflow:
- Complete file structure for components
- Package configuration and dependencies
- TypeScript definitions for components and mixins
- License headers and documentation requirements

Testing Requirements:
- Unit tests for functionality, properties, events, and accessibility
- DOM snapshot tests
- Visual regression tests for Lumo, Aura, and base themes
- TypeScript type tests
- Keyboard interaction testing

Accessibility:
- ARIA requirements and roles
- Keyboard support patterns
- Focus management
- State attribute synchronization

Documentation:
- JSDoc comment patterns
- README structure
- API documentation requirements

Common Patterns:
- Interactive components (button-like)
- Field components (input-like)
- Overlay components (popup/dialog)
- List/data components

This guide uses modern Lit patterns and supports both Vaadin themes (Lumo and Aura), ensuring consistency across the component library.
- Remove unused changedProperties parameter from firstUpdated()
- Replace TooltipController examples with more common role attribute pattern
- Update field component examples to use InputControlMixin instead of TextFieldMixin/InputFieldMixin
- Remove legacy @type JSDoc annotations from property definitions
- Add type specifications to @attr annotations (e.g., @attr {boolean} disabled)
- Replace state: true with attribute: false for internal properties
- Remove shouldUpdate() lifecycle method (not commonly used)
- Remove DataProviderController from general controllers list
- Remove LumoInjection CSS properties to align with pure Lit pattern
@sonarqubecloud
Copy link

@Artur- Artur- marked this pull request as ready for review December 12, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants