Component Library Overview
The Proton WebClients component library provides a comprehensive set of reusable UI components for building consistent, accessible web applications across the Proton ecosystem.Architecture
The component library is located inpackages/components/ and includes:
- Components: Core UI components in
components/ - Containers: Higher-level composed components in
containers/ - Hooks: Reusable React hooks in
hooks/ - Helpers: Utility functions in
helpers/
Key Features
TypeScript Support
All components are written in TypeScript with full type definitions, providing excellent developer experience with autocompletion and type safety.Accessibility
Components follow WAI-ARIA guidelines and include:- Proper ARIA attributes
- Keyboard navigation support
- Screen reader compatibility
- Focus management
Theming
Components use CSS custom properties and utility classes for consistent theming across the Proton design system.Responsive Design
Components are built with responsive design in mind, adapting to different screen sizes and devices.Component Categories
Basic Components
- Buttons - Various button types and button groups
- Inputs - Form inputs, checkboxes, radio buttons
- Forms - Form components and validation
Complex Components
- Modals - Dialog and modal windows
- Dropdowns - Dropdown menus and selects
- Tables - Data tables with sorting
Layout Components
Specialized Components
Installation
The component library is installed as part of the Proton WebClients monorepo:Usage
Import components from the components package:Best Practices
Component Selection
- Use newer “Two” variants when available (e.g.,
ModalTwo,SelectTwo) - Check deprecation notices in component files
- Prefer components from
@proton/atomsfor basic elements
Styling
- Use utility classes for spacing and layout
- Use
clsxfor conditional class names - Avoid inline styles when possible
Performance
- Use
React.memo()for expensive components - Implement proper key props for lists
- Avoid unnecessary re-renders
Development
Testing
Components include Jest tests:Linting
Code is linted with ESLint:Next Steps
- Get Started - Learn how to use components
- Buttons - Explore button components
- Inputs - Learn about form inputs