🧒
Sunbird ED
new release -7.0.0 (Jun 2024)Askdot
release-6.0.0
release-6.0.0
  • Learn
    • Overview
    • Capabilities
      • Learning Apps
      • Asset Sourcing
      • Organised Collections
      • Discover Content - Digital & Phygital
      • User Engagement
      • Rich and diverse content
      • Versatile Question Bank
      • Observability
      • Launch Course
      • Verifiable Credentials
      • Multi-Channel Chatbot
      • Targeted Programs
      • Manage Learn
        • Overview
        • What is an entity?
        • What is a Program?
        • What is a Project?
        • What is Observation?
        • What is a Survey?
        • What is Observation as a task inside a Project?
      • Product and Developer's Guide
        • Learning apps
          • Workflows
            • Onboarding of Users
            • Discovery of Content
            • Play content
            • Track progress and Earn credentials
            • Interacting / Collaborating
        • Asset Sourcing
        • Organised Collections
        • Discover Content - Digital & Phygital
        • User Engagement
        • Rich and Diverse Content
        • Versatile Question Bank
        • Observability
        • Launch Courses
        • Verifiable Credentials
        • Multi-Channel Chatbot
        • Targeted Programs
        • Manage Learn
          • Overview
          • Component Diagram
          • ML Core Service
          • ML Project Service
          • ML Survey Service
          • ML Report Service
          • ML Analytics Service
    • Tech Overview
      • Design Principles
      • Technical Architecture Diagram
      • Tech Stack
    • Adopters
      • DIKSHA
    • Roadmap
  • USE
    • Getting started
      • Deployment Overview
      • Pre-requisites
      • Install
        • Provision Cloud Infrastructure
        • Setup Jenkins
        • Update Ansible Variables
        • Build, Provision and Deploy
        • Functional Configurations
    • Latest Release - 6.0.1
      • Release notes
      • Updating Sunbird Releases
        • 5.2.0 to 6.0.1
      • Release Calendar 6.0.1
      • Demo of released items
    • Developer Guide
      • Architecture - Component Diagram
      • System Requirements
      • Install Locally
        • SunbirdED Mobile
        • SunbirdED Portal
      • Easy Installer
      • Configuration
        • SunbirdEd Portal
        • Sunbird Mobile
      • Portal
        • Component Diagram
      • Desktop
        • Component Diagram
      • Mobile
        • Component Diagram
        • sunbird-mobile-sdk
        • Sunbird-mobile-app plugins
        • Configurations to setup mobile app
      • Form service
        • Component Diagram
        • Data model
        • API's
      • Manage Learn
        • ML Core Service
          • Overview
          • User Flow Diagram
          • Component Diagram
          • Data Model
          • Folder Structure
          • API's
          • Deployment Overview
          • Local Service Setup Guide
        • ML Project Service
          • Overview
          • User Flow Diagram
          • Component Diagram
          • Data Model
          • Folder Structure
          • API's
          • Deployment Overview
          • Local Service Setup Guide
        • ML Survey Service
          • Overview
          • User Flow Diagram
          • Component Diagram
          • Data Model
          • Folder Structure
          • API's
          • Deployment Overview
          • Local Service Setup Guide
        • ML Report Service
          • Overview
          • User Flow Diagram
          • Component Diagram
          • Data Model
          • Folder Structure
          • API's
          • Deployment Overview
          • Local Service Setup Guide
        • ML Analytics Service
          • Overview
          • Component Diagram
          • Data Model
          • Setup Guide
            • ENV Variables ( Config.ini)
          • Ingestions
          • Folder Structure
          • Report creation and Updation Scripts
          • Deployment Overview
      • UI (User interface)
        • Angular Material
          • Overview
          • Installation
          • Material Icons
          • Components Usage
          • Theming
          • Theme Setup
          • Customization
            • Palette
            • Theme
            • Accessibility
            • Colors
            • Typography
            • Components
              • Buttons
              • Card
              • Toolbar
              • Dialog
              • Menu
          • CC Components
            • Card
            • Chips
            • Expansion Panel
        • Component Style Guide Version 1
          • Accordion
          • Buttons
          • Cards
          • Forms
          • Grid & Layout
          • Labels
          • Modals
          • Pagination
          • Rating
          • Search Box
          • Select Box
          • Tables
          • Tabs
          • Toast messages
          • Tooltip
          • Typography
        • SB-Styles: A Comprehensive Design Resource
        • SB-Themes Repository: Unifying Design Across Platforms
          • Classical Theme in Sunbird-Ed portal
          • Joyful Theme in Sunbird-Ed portal:
      • Reference Apps
        • Independent Libraries
          • Common Consumption Components
          • SunbirdEd Forms
          • Sunbird Client Services
          • Sunbird Styles
          • Sunbird Themes
          • Sunbird Tag Manager
      • API's
      • Admin Dashboard Reports
      • CSP changes
      • Reports
      • Other
        • Minimal forms
        • Telemetry
          • Trackable Collection
        • Platform
        • Learning Apps
    • Learn More
      • Dependencies
      • Specifications
        • SOFIE
        • SOFIE Implementation
  • Engage
    • Discuss
    • Contribute to ED
    • Extend / Contribute to Sunbird
    • Issue tracker/ Create Issue
  • Misc
    • Templates
      • Upgrade Sunbird release document
      • Release Notes
    • Misc Pages
      • Portal - Manage Learn - Reports
      • App - Manage Learn - component diagram
        • Projects
        • Observation & Survey
        • Program
      • Portal - Manage Learn - component diagram
      • Mobile form configurations
      • Content Indexing Flow
      • What are multiple databases used for
      • Course completion, reports and certificate issue
      • How to access Flink UI
      • What are all the flink jobs for
      • How does data flow into Druid
      • Minimal build properties
    • Archived
      • High Level Capabilities
      • Workflows
      • Where Sunbird ED helps you
      • ED - Mobile App (going to archive)
        • 4.10.3 to 5.0.0
        • 5.0.0 to 5.1.0
      • Setting up Sunbird ED
      • Developer Documentation
      • API Reference Documentation
      • Detailed Documentation
      • Source Code
      • Actors & Actions
      • Detailed Capabilities
      • Data
      • Terminology
      • 5.1.0-hotfix (OCI )
Powered by GitBook
On this page
  1. USE
  2. Developer Guide
  3. UI (User interface)
  4. Angular Material
  5. CC Components

Chips

Last updated 1 year ago

"" are components provided by Angular Material, designed for creating visually appealing and interactive chips or tags in a user interface. These chips are commonly used to represent discrete pieces of information or items that can be selected, filtered, or removed. Key features and characteristics of mat chips typically include:

  1. Visual Representation: Mat chips provide a visually distinct representation of items or categories in the form of small, rounded rectangles. Each chip typically contains text or other content.

  2. Interactive: Users can interact with mat chips, such as selecting, deselecting, or removing them by clicking or tapping.

  3. Selection State: Mat chips often support selection states, making them suitable for implementing tags, filters, or multi-selection options.

  4. Custom Styling: Angular Material provides theming and styling options that allow you to customize the appearance of mat chips to match your application's design and branding.

  5. Accessibility: Mat chips are designed with accessibility in mind, ensuring keyboard navigation and screen reader compatibility.

Mat chips are commonly used in various contexts, including:

  • Tags: Representing tags associated with an item, post, or category.

  • Filters: Allowing users to filter and narrow down options.

  • Selection Controls: Enabling multi-selection of items in a list.

  • Input Components: Creating dynamic input fields with chips for adding items.

Here's a basic example of how you can use the mat-chip component in an Angular Material application:

<mat-chip-list aria-label="Fish selection">
  <mat-chip>One fish</mat-chip>
  <mat-chip>Two fish</mat-chip>
  <mat-chip color="primary" selected>Primary fish</mat-chip>
  <mat-chip color="accent" selected>Accent fish</mat-chip>
</mat-chip-list>

The resulting output will appear as follows:

Customization

In our application, we have implemented customized chips.

Before writing code in our HTML components, we initially imported and declared the MatChipsModule in "pills-grid.module.ts".

import { MatChipsModule } from '@angular/material/chips';

@NgModule({
  declarations: [
    PillsGridComponent,
    PillItemComponent
  ],
  imports: [
    MatChipsModule
  ],
  exports: [
    PillsGridComponent,
    PillItemComponent
  ]
})

After importing the module, we proceeded to add the chips code in "pill-item.component.html"

<mat-chip-list>
    <mat-chip aria-label="subjects selection" class="item" (click)="onClick($event)" role="button" tabindex="0">
      <span *ngIf="icon" [ngStyle]="{'background-color':theme?.iconBgColor}" class="mr-8 img">
        <img alt="{{name}} icon" src="{{icon}}" class="w-100">
      </span>
      <label [ngStyle]="{'color':theme?.pillTextColor}" class="mb-0" *ngIf="name">{{name}}</label>
    </mat-chip>
  </mat-chip-list>

We established a mixin named "theme-mat-chips" in "_mat-chips.scss" situated within the "mat-themes" folder. Subsequently, this "_mat-chips.scss" was imported into the "includes.scss" file.

_mat-chips.scss
@mixin theme-mat-chips($theme) {
  // Get the color config from the theme.
  $color-config: mat.get-color-config($theme);
  // Get the primary color palette from the color-config.
  $primary: map.get($color-config, 'primary');
  $accent: map.get($color-config, 'accent');
  $warn: map.get($color-config, 'warn');
  $background: map.get($color-config, 'background');

  .mat-card .mat-chip.mat-standard-chip{
    background-color: mat.get-color-from-palette($background, status-bar);
  }
  .mat-chip.mat-standard-chip{
    background-color: mat.get-color-from-palette($background, background);
  }
  .mat-chip.mat-standard-chip{
    font-weight: 700;
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: inherit;
    &::after{
      background: none;
    }
  }
  .mat-chip-list-wrapper{
    justify-content: center;
  }
}
includes.scss
@import './mat-chips';

A mixin was crafted and then imported into the "themes.scss" file within the "app-themes" section.

themes.scss
@include theme-mat-chips($app-themes);

The end result will be as follows:

Mat chips are a versatile and user-friendly way to manage and display categorized information or user selections in your application.

Mat chips