clarity
Clarity is a scalable, accessible, customizable, open source design system built with web components. Works with any JavaScript framework, built for enterprises, and designed to be inclusive.
Top Related Projects
Component infrastructure and Material Design components for Angular
The Most Complete Angular UI Component Library
Angular powered Bootstrap
Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
An enterprise-class UI design language and React UI library
Quick Overview
Clarity is an open-source design system and component library developed by VMware. It provides a set of reusable UI components, patterns, and guidelines for building consistent and user-friendly web applications. Clarity is designed to work with Angular but also offers core components that can be used with other frameworks.
Pros
- Comprehensive set of UI components and design patterns
- Accessibility-focused, with WCAG 2.1 AA compliance
- Responsive design, suitable for various screen sizes and devices
- Active community and regular updates
Cons
- Primarily focused on Angular, which may limit adoption for non-Angular projects
- Steeper learning curve compared to some other UI libraries
- Opinionated design system may not fit all project aesthetics
- Large bundle size if using the full library
Code Examples
- Using a Clarity button component:
<button class="btn btn-primary">Primary Button</button>
- Creating a basic form with Clarity:
<form clrForm>
<clr-input-container>
<label>Username</label>
<input clrInput type="text" [(ngModel)]="username" name="username" required>
</clr-input-container>
<clr-password-container>
<label>Password</label>
<input clrPassword type="password" [(ngModel)]="password" name="password" required>
</clr-password-container>
<button class="btn btn-primary" type="submit">Submit</button>
</form>
- Implementing a Clarity data grid:
<clr-datagrid>
<clr-dg-column>User ID</clr-dg-column>
<clr-dg-column>Name</clr-dg-column>
<clr-dg-column>Email</clr-dg-column>
<clr-dg-row *ngFor="let user of users">
<clr-dg-cell>{{user.id}}</clr-dg-cell>
<clr-dg-cell>{{user.name}}</clr-dg-cell>
<clr-dg-cell>{{user.email}}</clr-dg-cell>
</clr-dg-row>
<clr-dg-footer>{{users.length}} users</clr-dg-footer>
</clr-datagrid>
Getting Started
To get started with Clarity in an Angular project:
- Install Clarity packages:
ng add @clr/angular
- Import Clarity modules in your app.module.ts:
import { ClarityModule } from '@clr/angular';
@NgModule({
imports: [
ClarityModule,
// other imports
],
// ...
})
export class AppModule { }
- Use Clarity components in your templates:
<clr-main-container>
<clr-header>
<div class="branding">
<a href="#" class="nav-link">
<span class="title">My Clarity App</span>
</a>
</div>
</clr-header>
<div class="content-container">
<main class="content-area">
<!-- Your app content here -->
</main>
</div>
</clr-main-container>
Competitor Comparisons
Component infrastructure and Material Design components for Angular
Pros of Components
- More comprehensive set of UI components and features
- Larger community and more frequent updates
- Tighter integration with Angular framework
Cons of Components
- Steeper learning curve for beginners
- Less opinionated design system, requiring more customization
Code Comparison
Components:
import { MatButtonModule } from '@angular/material/button';
@NgModule({
imports: [MatButtonModule],
// ...
})
export class AppModule { }
Clarity:
import { ClarityModule } from '@clr/angular';
@NgModule({
imports: [ClarityModule],
// ...
})
export class AppModule { }
Summary
Components offers a more extensive set of UI components and benefits from a larger community and frequent updates. It integrates seamlessly with Angular but may have a steeper learning curve. Clarity provides a more opinionated design system, which can be easier for beginners but may offer less flexibility.
Both libraries require similar import statements in the app module, with Components using specific imports for each component and Clarity using a single module import. The choice between the two depends on project requirements, team expertise, and desired design consistency.
The Most Complete Angular UI Component Library
Pros of PrimeNG
- More comprehensive component library with a wider range of UI elements
- Active development and frequent updates
- Strong community support and extensive documentation
Cons of PrimeNG
- Steeper learning curve due to the large number of components
- Potentially larger bundle size if not properly optimized
Code Comparison
PrimeNG example:
import { Component } from '@angular/core';
@Component({
selector: 'app-button-demo',
template: '<p-button label="Click me"></p-button>'
})
export class ButtonDemoComponent { }
Clarity example:
import { Component } from '@angular/core';
@Component({
selector: 'app-button-demo',
template: '<button class="btn btn-primary">Click me</button>'
})
export class ButtonDemoComponent { }
Both frameworks provide Angular-based UI components, but PrimeNG offers a more extensive set of pre-built components with richer functionality. Clarity focuses on a clean, minimalist design approach, while PrimeNG provides more customization options out of the box. PrimeNG's active development and community support give it an edge in terms of ongoing improvements and issue resolution. However, Clarity's simpler API and smaller component set may be easier for beginners to grasp initially.
Angular powered Bootstrap
Pros of ng-bootstrap
- Lighter weight and more focused on Bootstrap integration with Angular
- More frequent updates and active community support
- Easier to customize and extend due to simpler architecture
Cons of ng-bootstrap
- Less comprehensive component library compared to Clarity
- Lacks some advanced features and enterprise-level components
- May require more manual styling and configuration
Code Comparison
ng-bootstrap example:
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@NgModule({
imports: [NgbModule],
// ...
})
export class AppModule { }
Clarity example:
import { ClarityModule } from '@clr/angular';
@NgModule({
imports: [ClarityModule],
// ...
})
export class AppModule { }
Both libraries offer easy integration with Angular applications, but ng-bootstrap focuses on Bootstrap components, while Clarity provides a more comprehensive design system.
ng-bootstrap is ideal for projects that want to leverage Bootstrap's styling with Angular, offering a lightweight solution. Clarity, on the other hand, provides a complete design system with more advanced components, making it suitable for larger enterprise applications.
The choice between the two depends on project requirements, desired customization level, and the need for specific components or design patterns.
Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
Pros of ngx-bootstrap
- Lightweight and modular, allowing developers to import only needed components
- Extensive documentation and examples for each component
- Regular updates and active community support
Cons of ngx-bootstrap
- Less comprehensive design system compared to Clarity
- May require more custom styling to achieve a cohesive look
- Steeper learning curve for some complex components
Code Comparison
ngx-bootstrap:
<button type="button" class="btn btn-primary"
tooltip="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.">
Simple demo
</button>
Clarity:
<clr-tooltip>
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
<clr-tooltip-content clrPosition="right" clrSize="xs" *clrIfOpen>
<span>This is a tooltip.</span>
</clr-tooltip-content>
</clr-tooltip>
Both libraries offer tooltip functionality, but Clarity provides a more structured approach with separate elements for trigger and content. ngx-bootstrap uses a simpler attribute-based implementation, which may be easier to implement quickly but offers less flexibility in terms of styling and positioning.
:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
Pros of Nebular
- More customizable and flexible theming system
- Extensive set of UI components and modules
- Active development and frequent updates
Cons of Nebular
- Steeper learning curve for beginners
- Less comprehensive documentation compared to Clarity
- Smaller community and ecosystem
Code Comparison
Nebular component usage:
<nb-card>
<nb-card-header>Header</nb-card-header>
<nb-card-body>Body</nb-card-body>
<nb-card-footer>Footer</nb-card-footer>
</nb-card>
Clarity component usage:
<clr-card>
<clr-card-header>Header</clr-card-header>
<clr-card-block>Body</clr-card-block>
<clr-card-footer>Footer</clr-card-footer>
</clr-card>
Both frameworks offer similar component structures, but Nebular uses the nb-
prefix, while Clarity uses clr-
. Nebular's syntax is slightly more concise, using nb-card-body
instead of Clarity's clr-card-block
.
Nebular provides more advanced theming capabilities and a wider range of UI components, making it suitable for complex applications. However, Clarity offers better documentation and a larger community, which can be beneficial for beginners and enterprise projects. The choice between the two depends on specific project requirements and developer preferences.
An enterprise-class UI design language and React UI library
Pros of Ant Design
- Larger community and more frequent updates
- Extensive component library with rich customization options
- Better internationalization support
Cons of Ant Design
- Steeper learning curve due to its comprehensive nature
- Heavier bundle size, which may impact performance
Code Comparison
Ant Design button example:
import { Button } from 'antd';
const MyComponent = () => (
<Button type="primary">Click me</Button>
);
Clarity button example:
<button class="btn btn-primary">
Click me
</button>
Ant Design offers a more React-centric approach with component imports, while Clarity primarily uses CSS classes for styling and functionality. Ant Design's approach may be more intuitive for React developers, but Clarity's method can be easier to implement in existing projects.
Both libraries provide comprehensive design systems, but Ant Design generally offers more flexibility and customization options. However, this comes at the cost of increased complexity and a larger bundle size. Clarity, being more lightweight, may be preferable for simpler projects or those with strict performance requirements.
Ultimately, the choice between Ant Design and Clarity depends on project requirements, team expertise, and performance considerations.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
NOTE: The Clarity Design System has moved and is now split into two repositories, one for Clarity Angular and one for Clarity Core. This repository is now for archived purposes only.
Clarity Design System
Clarity is an open source design system that brings together UX guidelines, design resources, and coding implementations with Web Components. This repository includes everything you need to build, customize, test, and deploy Clarity. For complete documentation, visit the Clarity website.
If you are looking for Clarity Angular, our previous implementation of Clarity built
in Angular, please see the angular
branch for the latest version there.
Getting Started
Clarity is published as five npm packages:
- Contains the Web Components that work in any JavaScript framework.
- Contains shims for core usage in Angular environment
- Contains shims for core usage in React environment
- Our open source sans-serif typeface.
Installing Clarity
Visit our documentation at https://clarity.design/get-started/
Documentation
For documentation on the Clarity Design System, including a list of components and example usage, see our website.
Contributing
The Clarity project team welcomes contributions from the community. For more detailed information, see our contribution guidances.
Licenses
- The Clarity Design System is licensed under the MIT license.
Feedback
If you find a bug or want to request a new feature, please open a GitHub issue.
Include a link to the reproduction scenario you created by forking one of the Clarity Stackblitz Templates for the version you are using at Clarity StackBlitz templates.
Support
For our support policies please visit https://clarity.design/get-started/support/
For questions, ideas, or just reaching out to the team feel free to open a discussion in our GitHub Disscussion section.
Top Related Projects
Component infrastructure and Material Design components for Angular
The Most Complete Angular UI Component Library
Angular powered Bootstrap
Fast and reliable Bootstrap widgets in Angular (supports Ivy engine)
:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
An enterprise-class UI design language and React UI library
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot