Getting Started
This guide will help you understand how to use components from the Proton WebClients component library.Import Patterns
There are several ways to import components:From Package Index
Many components are exported from the main package index:Direct Component Imports
For specific components, import directly from their location:From Atoms Package
Basic components are available from@proton/atoms:
Basic Usage
Simple Component Example
Modal Example
Dropdown Example
Styling Components
Using Utility Classes
Proton uses Tailwind-style utility classes:Common Utility Classes
- Flexbox:
flex,flex-column,flex-nowrap,items-center,justify-between - Spacing:
p-4,m-2,gap-2,px-3,py-2 - Sizing:
w-full,h-full,flex-1,shrink-0 - Colors:
color-norm,color-weak,bg-norm - Text:
text-bold,text-ellipsis,text-center
Conditional Styling with clsx
Use theclsx utility for conditional classes:
TypeScript Support
Using Component Props
Components export their prop types:Generic Components
Some components are generic and support type parameters:Common Patterns
Form Handling
Error Handling
Accessibility
ARIA Labels
Provide proper labels for accessibility:Keyboard Navigation
Components support keyboard navigation by default. Ensure you:- Don’t override
tabIndexunless necessary - Handle
EnterandEscapekeys appropriately - Provide focus indicators