├── .browserslistrc ├── .editorconfig ├── .eslintrc.json ├── .firebase └── hosting.d3d3.cache ├── .firebaserc ├── .gitignore ├── README.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.json ├── firebase.json ├── ionic.config.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src ├── app │ ├── app-routing.module.ts │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── custom-checkbox │ │ ├── custom-checkbox.component.ts │ │ └── custom-checkbox.module.ts │ ├── tab1 │ │ ├── tab1-routing.module.ts │ │ ├── tab1.module.ts │ │ ├── tab1.page.html │ │ ├── tab1.page.scss │ │ ├── tab1.page.spec.ts │ │ └── tab1.page.ts │ ├── tab2 │ │ ├── tab2-routing.module.ts │ │ ├── tab2.module.ts │ │ ├── tab2.page.html │ │ ├── tab2.page.scss │ │ ├── tab2.page.spec.ts │ │ └── tab2.page.ts │ ├── tab3 │ │ ├── tab3-routing.module.ts │ │ ├── tab3.module.ts │ │ ├── tab3.page.html │ │ ├── tab3.page.scss │ │ ├── tab3.page.spec.ts │ │ └── tab3.page.ts │ ├── tab4 │ │ ├── checkbox-checked.validator.ts │ │ ├── tab4-routing.module.ts │ │ ├── tab4.module.ts │ │ ├── tab4.page.html │ │ ├── tab4.page.scss │ │ ├── tab4.page.spec.ts │ │ └── tab4.page.ts │ └── tabs │ │ ├── tabs-routing.module.ts │ │ ├── tabs.module.ts │ │ ├── tabs.page.html │ │ ├── tabs.page.scss │ │ ├── tabs.page.spec.ts │ │ └── tabs.page.ts ├── assets │ ├── icon │ │ └── favicon.png │ └── shapes.svg ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── global.scss ├── index.html ├── main.ts ├── polyfills.ts ├── test.ts ├── theme │ └── variables.scss └── zone-flags.ts ├── tsconfig.app.json ├── tsconfig.json └── tsconfig.spec.json /.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 18 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": ["projects/**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts"], 7 | "parserOptions": { 8 | "project": ["tsconfig.json", "e2e/tsconfig.json"], 9 | "createDefaultProgram": true 10 | }, 11 | "extends": [ 12 | "plugin:@angular-eslint/ng-cli-compat", 13 | "plugin:@angular-eslint/ng-cli-compat--formatting-add-on", 14 | "plugin:@angular-eslint/template/process-inline-templates" 15 | ], 16 | "rules": { 17 | "@angular-eslint/component-class-suffix": [ 18 | "error", 19 | { 20 | "suffixes": ["Page", "Component"] 21 | } 22 | ], 23 | "@angular-eslint/component-selector": [ 24 | "error", 25 | { 26 | "type": "element", 27 | "prefix": "app", 28 | "style": "kebab-case" 29 | } 30 | ], 31 | "@angular-eslint/directive-selector": [ 32 | "error", 33 | { 34 | "type": "attribute", 35 | "prefix": "app", 36 | "style": "camelCase" 37 | } 38 | ] 39 | } 40 | }, 41 | { 42 | "files": ["*.html"], 43 | "extends": ["plugin:@angular-eslint/template/recommended"], 44 | "rules": {} 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "ioniconf-2021" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Specifies intentionally untracked files to ignore when using Git 2 | # http://git-scm.com/docs/gitignore 3 | 4 | *~ 5 | *.sw[mnpcod] 6 | .tmp 7 | *.tmp 8 | *.tmp.* 9 | *.sublime-project 10 | *.sublime-workspace 11 | .DS_Store 12 | Thumbs.db 13 | UserInterfaceState.xcuserstate 14 | $RECYCLE.BIN/ 15 | 16 | *.log 17 | log.txt 18 | npm-debug.log* 19 | 20 | /.idea 21 | /.ionic 22 | /.sass-cache 23 | /.sourcemaps 24 | /.versions 25 | /.vscode 26 | /coverage 27 | /dist 28 | /node_modules 29 | /platforms 30 | /plugins 31 | /www 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Customizing Ionic Components 2 | 3 | This repo is part of the tutorial: [**How to build any UI with Ionic**](https://ionicthemes.com/tutorials/how-to-build-any-ui-with-ionic). 4 | 5 | In this post we discuss different strategies you can use to customize and extend the Ionic UI Components to create any user interface you want. 6 | 7 | Hopefully you would learn how to approach the task of building reusable UI kits or design systems and create your own components to improve the efficiency in future projects. 8 | 9 | - [DEMO](https://ioniconf-2021.web.app/) 10 | - [TUTORIAL](https://ionicthemes.com/tutorials/how-to-build-any-ui-with-ionic) 11 | 12 | ![](https://static.ionicthemes.com/freebies/customizing-ionic-components-freebie.png) 13 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "defaultProject": "app", 5 | "newProjectRoot": "projects", 6 | "projects": { 7 | "app": { 8 | "root": "", 9 | "sourceRoot": "src", 10 | "projectType": "application", 11 | "prefix": "app", 12 | "schematics": {}, 13 | "architect": { 14 | "build": { 15 | "builder": "@angular-devkit/build-angular:browser", 16 | "options": { 17 | "outputPath": "www", 18 | "index": "src/index.html", 19 | "main": "src/main.ts", 20 | "polyfills": "src/polyfills.ts", 21 | "tsConfig": "tsconfig.app.json", 22 | "assets": [ 23 | { 24 | "glob": "**/*", 25 | "input": "src/assets", 26 | "output": "assets" 27 | }, 28 | { 29 | "glob": "**/*.svg", 30 | "input": "node_modules/ionicons/dist/ionicons/svg", 31 | "output": "./svg" 32 | } 33 | ], 34 | "styles": ["src/theme/variables.scss", "src/global.scss"], 35 | "scripts": [] 36 | }, 37 | "configurations": { 38 | "production": { 39 | "fileReplacements": [ 40 | { 41 | "replace": "src/environments/environment.ts", 42 | "with": "src/environments/environment.prod.ts" 43 | } 44 | ], 45 | "optimization": true, 46 | "outputHashing": "all", 47 | "sourceMap": false, 48 | "namedChunks": false, 49 | "aot": true, 50 | "extractLicenses": true, 51 | "vendorChunk": false, 52 | "buildOptimizer": true, 53 | "budgets": [ 54 | { 55 | "type": "initial", 56 | "maximumWarning": "2mb", 57 | "maximumError": "5mb" 58 | } 59 | ] 60 | }, 61 | "ci": { 62 | "progress": false 63 | } 64 | } 65 | }, 66 | "serve": { 67 | "builder": "@angular-devkit/build-angular:dev-server", 68 | "options": { 69 | "browserTarget": "app:build" 70 | }, 71 | "configurations": { 72 | "production": { 73 | "browserTarget": "app:build:production" 74 | }, 75 | "ci": { 76 | "progress": false 77 | } 78 | } 79 | }, 80 | "extract-i18n": { 81 | "builder": "@angular-devkit/build-angular:extract-i18n", 82 | "options": { 83 | "browserTarget": "app:build" 84 | } 85 | }, 86 | "test": { 87 | "builder": "@angular-devkit/build-angular:karma", 88 | "options": { 89 | "main": "src/test.ts", 90 | "polyfills": "src/polyfills.ts", 91 | "tsConfig": "tsconfig.spec.json", 92 | "karmaConfig": "karma.conf.js", 93 | "styles": [], 94 | "scripts": [], 95 | "assets": [ 96 | { 97 | "glob": "favicon.ico", 98 | "input": "src/", 99 | "output": "/" 100 | }, 101 | { 102 | "glob": "**/*", 103 | "input": "src/assets", 104 | "output": "/assets" 105 | } 106 | ] 107 | }, 108 | "configurations": { 109 | "ci": { 110 | "progress": false, 111 | "watch": false 112 | } 113 | } 114 | }, 115 | "lint": { 116 | "builder": "@angular-eslint/builder:lint", 117 | "options": { 118 | "lintFilePatterns": [ 119 | "src/**/*.ts", 120 | "src/**/*.html" 121 | ] 122 | } 123 | }, 124 | "e2e": { 125 | "builder": "@angular-devkit/build-angular:protractor", 126 | "options": { 127 | "protractorConfig": "e2e/protractor.conf.js", 128 | "devServerTarget": "app:serve" 129 | }, 130 | "configurations": { 131 | "production": { 132 | "devServerTarget": "app:serve:production" 133 | }, 134 | "ci": { 135 | "devServerTarget": "app:serve:ci" 136 | } 137 | } 138 | }, 139 | "ionic-cordova-build": { 140 | "builder": "@ionic/angular-toolkit:cordova-build", 141 | "options": { 142 | "browserTarget": "app:build" 143 | }, 144 | "configurations": { 145 | "production": { 146 | "browserTarget": "app:build:production" 147 | } 148 | } 149 | }, 150 | "ionic-cordova-serve": { 151 | "builder": "@ionic/angular-toolkit:cordova-serve", 152 | "options": { 153 | "cordovaBuildTarget": "app:ionic-cordova-build", 154 | "devServerTarget": "app:serve" 155 | }, 156 | "configurations": { 157 | "production": { 158 | "cordovaBuildTarget": "app:ionic-cordova-build:production", 159 | "devServerTarget": "app:serve:production" 160 | } 161 | } 162 | } 163 | } 164 | } 165 | }, 166 | "cli": { 167 | "defaultCollection": "@ionic/angular-toolkit" 168 | }, 169 | "schematics": { 170 | "@ionic/angular-toolkit:component": { 171 | "styleext": "scss" 172 | }, 173 | "@ionic/angular-toolkit:page": { 174 | "styleext": "scss" 175 | } 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | SELENIUM_PROMISE_MANAGER: false, 20 | baseUrl: 'http://localhost:4200/', 21 | framework: 'jasmine', 22 | jasmineNodeOpts: { 23 | showColors: true, 24 | defaultTimeoutInterval: 30000, 25 | print: function() {} 26 | }, 27 | onPrepare() { 28 | require('ts-node').register({ 29 | project: require('path').join(__dirname, './tsconfig.json') 30 | }); 31 | jasmine.getEnv().addReporter(new SpecReporter({ 32 | spec: { 33 | displayStacktrace: StacktraceOption.PRETTY 34 | } 35 | })); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('new App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getPageTitle()).toContain('Tab 1'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getPageTitle() { 9 | return element(by.css('ion-title')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "module": "commonjs", 6 | "target": "es2018", 7 | "types": [ 8 | "jasmine", 9 | "node" 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": { 3 | "public": "www", 4 | "ignore": [ 5 | "firebase.json", 6 | "**/.*", 7 | "**/node_modules/**" 8 | ], 9 | "rewrites": [ 10 | { 11 | "source": "**", 12 | "destination": "/index.html" 13 | } 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom-components", 3 | "integrations": {}, 4 | "type": "angular" 5 | } 6 | -------------------------------------------------------------------------------- /karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | jasmine: { 17 | // you can add configuration options for Jasmine here 18 | // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html 19 | // for example, you can disable the random execution with `random: false` 20 | // or set a specific seed with `seed: 4321` 21 | }, 22 | clearContext: false // leave Jasmine Spec Runner output visible in browser 23 | }, 24 | jasmineHtmlReporter: { 25 | suppressAll: true // removes the duplicated traces 26 | }, 27 | coverageReporter: { 28 | dir: require('path').join(__dirname, './coverage/ngv'), 29 | subdir: '.', 30 | reporters: [ 31 | { type: 'html' }, 32 | { type: 'text-summary' } 33 | ] 34 | }, 35 | reporters: ['progress', 'kjhtml'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false, 42 | restartOnFileChange: true 43 | }); 44 | }; 45 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom-components", 3 | "version": "0.0.1", 4 | "author": "Ionic Framework", 5 | "homepage": "https://ionicframework.com/", 6 | "scripts": { 7 | "ng": "ng", 8 | "start": "ng serve", 9 | "build": "ng build", 10 | "test": "ng test", 11 | "lint": "ng lint", 12 | "e2e": "ng e2e" 13 | }, 14 | "private": true, 15 | "dependencies": { 16 | "@angular/common": "~11.2.0", 17 | "@angular/core": "~11.2.0", 18 | "@angular/forms": "~11.2.0", 19 | "@angular/platform-browser": "~11.2.0", 20 | "@angular/platform-browser-dynamic": "~11.2.0", 21 | "@angular/router": "~11.2.0", 22 | "@ionic/angular": "^5.5.2", 23 | "rxjs": "~6.6.0", 24 | "tslib": "^2.0.0", 25 | "zone.js": "~0.10.2" 26 | }, 27 | "devDependencies": { 28 | "@angular-devkit/build-angular": "~0.1102.4", 29 | "@angular-eslint/builder": "2.0.2", 30 | "@angular-eslint/eslint-plugin": "2.0.2", 31 | "@angular-eslint/eslint-plugin-template": "2.0.2", 32 | "@angular-eslint/template-parser": "2.0.2", 33 | "@angular/cli": "~11.2.4", 34 | "@angular/compiler": "~11.2.0", 35 | "@angular/compiler-cli": "~11.2.0", 36 | "@angular/language-service": "~11.2.0", 37 | "@ionic/angular-toolkit": "^3.1.1", 38 | "@ionic/lab": "3.2.10", 39 | "@types/jasmine": "~3.6.0", 40 | "@types/jasminewd2": "~2.0.3", 41 | "@types/node": "^12.11.1", 42 | "@typescript-eslint/eslint-plugin": "4.16.1", 43 | "@typescript-eslint/parser": "4.16.1", 44 | "eslint": "^7.6.0", 45 | "eslint-plugin-import": "2.22.1", 46 | "eslint-plugin-jsdoc": "30.7.6", 47 | "eslint-plugin-prefer-arrow": "1.2.2", 48 | "jasmine-core": "~3.7.1", 49 | "jasmine-spec-reporter": "~5.0.0", 50 | "karma": "~5.2.0", 51 | "karma-chrome-launcher": "~3.1.0", 52 | "karma-coverage": "~2.0.3", 53 | "karma-coverage-istanbul-reporter": "~3.0.2", 54 | "karma-jasmine": "~4.0.0", 55 | "karma-jasmine-html-reporter": "^1.5.0", 56 | "protractor": "~7.0.0", 57 | "ts-node": "~8.3.0", 58 | "typescript": "~4.0.2" 59 | }, 60 | "description": "An Ionic project" 61 | } 62 | -------------------------------------------------------------------------------- /src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; 3 | 4 | const routes: Routes = [ 5 | { 6 | path: '', 7 | loadChildren: () => import('./tabs/tabs.module').then(m => m.TabsPageModule) 8 | } 9 | ]; 10 | @NgModule({ 11 | imports: [ 12 | RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules }) 13 | ], 14 | exports: [RouterModule] 15 | }) 16 | export class AppRoutingModule {} 17 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/how-to-build-any-ui-with-ionic/448ea7e658fb72ee46ef488ef247dad3976a814e/src/app/app.component.scss -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { TestBed, waitForAsync } from '@angular/core/testing'; 3 | 4 | import { AppComponent } from './app.component'; 5 | 6 | describe('AppComponent', () => { 7 | 8 | beforeEach(waitForAsync(() => { 9 | 10 | TestBed.configureTestingModule({ 11 | declarations: [AppComponent], 12 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 13 | }).compileComponents(); 14 | })); 15 | 16 | it('should create the app', () => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app).toBeTruthy(); 20 | }); 21 | // TODO: add more tests! 22 | 23 | }); 24 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: 'app.component.html', 6 | styleUrls: ['app.component.scss'], 7 | }) 8 | export class AppComponent { 9 | constructor() {} 10 | } 11 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { BrowserModule } from '@angular/platform-browser'; 3 | import { RouteReuseStrategy } from '@angular/router'; 4 | 5 | import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; 6 | 7 | import { AppRoutingModule } from './app-routing.module'; 8 | import { AppComponent } from './app.component'; 9 | 10 | @NgModule({ 11 | declarations: [AppComponent], 12 | entryComponents: [], 13 | imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule], 14 | providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }], 15 | bootstrap: [AppComponent], 16 | }) 17 | export class AppModule {} 18 | -------------------------------------------------------------------------------- /src/app/custom-checkbox/custom-checkbox.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, ContentChild, HostBinding } from '@angular/core'; 2 | import { IonCheckbox } from '@ionic/angular'; 3 | 4 | @Component({ 5 | selector: 'app-custom-checkbox', 6 | template: '', 7 | styles: [':host { display: block; }'], 8 | }) 9 | 10 | export class CustomCheckboxComponent { 11 | 12 | // get access to the IonCheckbox element 13 | @ContentChild(IonCheckbox) checkbox: IonCheckbox; 14 | 15 | @HostBinding('class.checkbox-checked') isChecked: boolean; 16 | 17 | constructor() {} 18 | 19 | ngAfterContentInit() { 20 | // set the checked state 21 | this.isChecked = this.checkbox.checked; 22 | 23 | // subscribe to changes 24 | this.checkbox.ionChange.subscribe(changes => { 25 | this.isChecked = changes.detail.checked; 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/app/custom-checkbox/custom-checkbox.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { CustomCheckboxComponent } from './custom-checkbox.component'; 4 | 5 | @NgModule({ 6 | declarations: [CustomCheckboxComponent], 7 | imports: [CommonModule], 8 | exports: [CustomCheckboxComponent] 9 | }) 10 | export class CustomCheckboxModule { } 11 | -------------------------------------------------------------------------------- /src/app/tab1/tab1-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { Tab1Page } from './tab1.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: Tab1Page, 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class Tab1PageRoutingModule {} 17 | -------------------------------------------------------------------------------- /src/app/tab1/tab1.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { NgModule } from '@angular/core'; 3 | import { CommonModule } from '@angular/common'; 4 | import { FormsModule } from '@angular/forms'; 5 | import { Tab1Page } from './tab1.page'; 6 | import { Tab1PageRoutingModule } from './tab1-routing.module'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | IonicModule, 11 | CommonModule, 12 | FormsModule, 13 | Tab1PageRoutingModule 14 | ], 15 | declarations: [Tab1Page] 16 | }) 17 | export class Tab1PageModule {} 18 | -------------------------------------------------------------------------------- /src/app/tab1/tab1.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Level #1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Level #1 13 | 14 | 15 | 16 |
17 |

Let's customize Ionic Components by using CSS variables and Shadow Parts.

18 | 19 |

Ion Checkbox

20 |

Check out all the CSS Custom Properties and Shadow Parts available for customization.

21 | 22 | 23 | 24 | CSS Properties 25 | 26 | 27 | Raw checkbox 28 | 29 | 30 | 31 | Background Color 32 | 33 | 34 | 35 | Border Color 36 | 37 | 38 | 39 | 40 | Square & Red 41 | 42 | 43 | 44 | 45 | 46 | Round 47 | 48 | 49 | 50 | 51 | Checkmark width 52 | 53 | 54 | 55 | 56 | 57 | Bigger Size 58 | 59 | 60 | 61 | 62 | Shadow Parts 63 | 64 | 65 | Custom Mark Icon 66 | 67 | 68 | 69 | 70 | Custom Mark Icon 71 | 72 | 73 | 74 | 75 | Custom Mark & Animation 76 | 77 | 78 | 79 | 80 |
81 |
82 | -------------------------------------------------------------------------------- /src/app/tab1/tab1.page.scss: -------------------------------------------------------------------------------- 1 | .custom-mark-plus { 2 | --checkmark-color: var(--ion-color-success-contrast); 3 | --checkmark-width: 4px; 4 | --background-checked: var(--ion-color-success); 5 | --border-color-checked: var(--ion-color-success); 6 | --border-color: var(--ion-color-success); 7 | --border-radius: 10px; 8 | --size: 28px; 9 | 10 | &::part(mark) { 11 | // this is the svg of the checkbox icon 12 | d: path("M18.75 12H5.25M12 5.25V18.75V5.25Z"); 13 | } 14 | } 15 | 16 | .custom-mark-star { 17 | --checkmark-color: var(--ion-color-warning); 18 | --checkmark-width: 2px; 19 | --background: transparent; 20 | --border-color: transparent; 21 | --background-checked: transparent; 22 | --border-color-checked: transparent; 23 | --size: 28px; 24 | 25 | &::part(mark) { 26 | // this is the svg of the checkbox icon 27 | // star icon 28 | d: path("M22.5 9.75H14.4375L12 2.25L9.5625 9.75H1.5L8.0625 14.25L5.53125 21.75L12 17.0625L18.4688 21.75L15.9375 14.25L22.5 9.75Z"); 29 | } 30 | 31 | &.checkbox-checked::part(mark) { 32 | fill: var(--ion-color-warning);; 33 | } 34 | 35 | &::part(mark) { 36 | opacity: 1; 37 | } 38 | } 39 | 40 | .custom-mark-heart { 41 | --checkmark-color: var(--ion-color-danger); 42 | --checkmark-width: 2px; 43 | --background: transparent; 44 | --border-color: transparent; 45 | --background-checked: transparent; 46 | --border-color-checked: transparent; 47 | --size: 28px; 48 | 49 | &::part(mark) { 50 | // this is the svg of the checkbox icon 51 | // heart icon 52 | d: path("M12 21L11.5782 20.7188C9.57284 19.3795 7.0355 17.8659 5.15628 15.6412C3.17581 13.2975 2.22565 10.8905 2.25003 8.28187C2.27956 5.36906 4.61534 3 7.4569 3C9.71206 3 11.2116 4.3125 12 5.25984C12.7885 4.3125 14.288 3 16.5432 3C19.3847 3 21.7205 5.36906 21.75 8.28047C21.7763 10.8905 20.8261 13.2961 18.8438 15.6398C16.9646 17.8659 14.4272 19.3795 12.4219 20.7188L12 21Z"); 53 | } 54 | 55 | &.checkbox-checked::part(mark) { 56 | fill: var(--ion-color-danger); 57 | } 58 | 59 | &::part(mark) { 60 | opacity: 1; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/app/tab1/tab1.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { IonicModule } from '@ionic/angular'; 3 | 4 | import { Tab1Page } from './tab1.page'; 5 | 6 | describe('Tab1Page', () => { 7 | let component: Tab1Page; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(waitForAsync(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [Tab1Page], 13 | imports: [IonicModule.forRoot()] 14 | }).compileComponents(); 15 | 16 | fixture = TestBed.createComponent(Tab1Page); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | })); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /src/app/tab1/tab1.page.ts: -------------------------------------------------------------------------------- 1 | import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'; 2 | import { createAnimation, Animation } from '@ionic/core'; 3 | 4 | @Component({ 5 | selector: 'app-tab1', 6 | templateUrl: 'tab1.page.html', 7 | styleUrls: ['tab1.page.scss'] 8 | }) 9 | export class Tab1Page implements AfterViewInit { 10 | 11 | @ViewChild('animatedIcon', { read: ElementRef }) animatedIcon: ElementRef; 12 | 13 | public favStateOn = false; 14 | public favOnAnimation: Animation; 15 | public favOffAnimation: Animation; 16 | 17 | constructor() {} 18 | 19 | ngAfterViewInit() { 20 | this.favOnAnimation = createAnimation('') 21 | .addElement(this.animatedIcon.nativeElement) 22 | .duration(500) 23 | .keyframes([ 24 | { offset: 0, transform: 'scale(1)', opacity: '0.4' }, 25 | { offset: 0.5, transform: 'scale(1.8)', opacity: '0.8' }, 26 | { offset: 1, transform: 'scale(1)', opacity: '1' }, 27 | ]); 28 | 29 | this.favOffAnimation = createAnimation('') 30 | .addElement(this.animatedIcon.nativeElement) 31 | .duration(500) 32 | .keyframes([ 33 | { offset: 0, transform: 'scale(0.8)', opacity: '0.4' }, 34 | { offset: 0.5, transform: 'scale(0.5)', opacity: '0.8' }, 35 | { offset: 1, transform: 'scale(1)', opacity: '1' } 36 | ]); 37 | } 38 | 39 | animate(): void { 40 | if (this.favStateOn) { 41 | this.favOnAnimation.stop(); 42 | this.favOffAnimation.play(); 43 | } else { 44 | this.favOffAnimation.stop(); 45 | this.favOnAnimation.play(); 46 | } 47 | this.favStateOn = !this.favStateOn; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/app/tab2/tab2-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { Tab2Page } from './tab2.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: Tab2Page, 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class Tab2PageRoutingModule {} 17 | -------------------------------------------------------------------------------- /src/app/tab2/tab2.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { NgModule } from '@angular/core'; 3 | import { CommonModule } from '@angular/common'; 4 | import { FormsModule } from '@angular/forms'; 5 | import { Tab2Page } from './tab2.page'; 6 | import { Tab2PageRoutingModule } from './tab2-routing.module'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | IonicModule, 11 | CommonModule, 12 | FormsModule, 13 | Tab2PageRoutingModule 14 | ], 15 | declarations: [Tab2Page] 16 | }) 17 | export class Tab2PageModule {} 18 | -------------------------------------------------------------------------------- /src/app/tab2/tab2.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Level #2 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Level #2 13 | 14 | 15 | 16 |
17 |

Add custom styles and compose with other elements.

18 | 19 |

What are you interested in?

20 |

Pick whatever catches your eye. You can always fine-tune things later.

21 | 22 | 23 | 24 |
25 | Food 26 | 27 |
28 |
29 | 30 |
31 | Hike 32 | 33 |
34 |
35 | 36 |
37 | Travel 38 | 39 |
40 |
41 | 42 |
43 | Fashion 44 | 45 |
46 |
47 |
48 |
49 |
50 | -------------------------------------------------------------------------------- /src/app/tab2/tab2.page.scss: -------------------------------------------------------------------------------- 1 | .checkbox-content { 2 | background: var(--img-src), rgba(0, 0, 0, .40); 3 | background-size: cover; 4 | background-blend-mode: overlay; 5 | border-radius: 10px; 6 | display: flex; 7 | height: 100%; 8 | width: 100%; 9 | justify-content: space-between; 10 | aspect-ratio: 1 / 1; 11 | 12 | .checkbox-title { 13 | color: var(--ion-color-light); 14 | font-weight: bold; 15 | align-self: flex-end; 16 | margin: 8px; 17 | font-size: 20px; 18 | } 19 | 20 | .checkbox-item { 21 | --background: transparent; 22 | --border-color: var(--ion-color-light); 23 | --size: 32px; 24 | margin: 8px; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/app/tab2/tab2.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { IonicModule } from '@ionic/angular'; 3 | 4 | import { Tab2Page } from './tab2.page'; 5 | 6 | describe('Tab2Page', () => { 7 | let component: Tab2Page; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(waitForAsync(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [Tab2Page], 13 | imports: [IonicModule.forRoot()] 14 | }).compileComponents(); 15 | 16 | fixture = TestBed.createComponent(Tab2Page); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | })); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /src/app/tab2/tab2.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-tab2', 5 | templateUrl: 'tab2.page.html', 6 | styleUrls: ['tab2.page.scss'] 7 | }) 8 | export class Tab2Page { 9 | 10 | constructor() {} 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/app/tab3/tab3-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { Tab3Page } from './tab3.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: Tab3Page, 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class Tab3PageRoutingModule {} 17 | -------------------------------------------------------------------------------- /src/app/tab3/tab3.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { NgModule } from '@angular/core'; 3 | import { CommonModule } from '@angular/common'; 4 | import { FormsModule } from '@angular/forms'; 5 | import { Tab3Page } from './tab3.page'; 6 | import { Tab3PageRoutingModule } from './tab3-routing.module'; 7 | import { CustomCheckboxModule } from '../custom-checkbox/custom-checkbox.module'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | IonicModule, 12 | CommonModule, 13 | FormsModule, 14 | Tab3PageRoutingModule, 15 | CustomCheckboxModule 16 | ], 17 | declarations: [Tab3Page] 18 | }) 19 | export class Tab3PageModule {} 20 | -------------------------------------------------------------------------------- /src/app/tab3/tab3.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Level #3 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Level #3 13 | 14 | 15 | 16 |
17 |

Add an element wrapper component and use it to enhance the element styles.

18 | 19 |

What are you interested in?

20 |

Pick whatever catches your eye. You can always fine-tune things later.

21 |
22 | 23 | 24 | 25 |
26 | Food 27 | 28 |
29 |
30 |
31 | 32 | 33 |
34 | Hike 35 | 36 |
37 |
38 |
39 |
40 | 41 | 42 | 43 |
44 | Travel 45 | 46 |
47 |
48 |
49 | 50 | 51 |
52 | Fashion 53 | 54 |
55 |
56 |
57 |
58 |
59 | 60 |

Other UI examples

61 |

Using the same Ion Checkbox

62 | 63 | 64 | Tasks 65 | 66 | 67 | 68 | 69 | 70 |
71 | 72 | 73 | 74 |
75 | 76 |

Newsletter signup form

77 |
78 |
79 |
80 | 81 |
82 |

June 26

83 |
84 | 4 85 | 86 | 2 87 | 88 |
89 |
90 |
91 |
92 |
93 | 94 | 95 | 96 |
97 | 98 |

IoniConf talk slides

99 |
100 |
101 |
102 | 103 |
104 |

June 23

105 |
106 | 2 107 | 108 |
109 |
110 |
111 |
112 |
113 |
114 | 115 | 116 | 117 | Meetings 118 | 119 | See All 120 | 121 | 122 | 123 |
124 | 125 | 126 | 127 | 128 | 129 |

Product Planning

130 |

10:00 am - 11:00 am

131 |
132 |
133 | 134 |
135 |
136 | 137 |
138 |
139 | 140 |
141 |
142 |
143 | 144 | 145 |

Confirm

146 |
147 |
148 |
149 |
150 |
151 | 152 | 153 | 154 | 155 | 156 |

PWA Session

157 |

11:30 am - 12:00 am

158 |
159 |
160 | 161 |
162 |
163 | 164 |
165 |
166 | 167 |
168 |
169 |
170 | 171 | 172 |

Confirm

173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 | -------------------------------------------------------------------------------- /src/app/tab3/tab3.page.scss: -------------------------------------------------------------------------------- 1 | .tasks-example { 2 | .task-wrapper { 3 | &.checkbox-checked { 4 | opacity: 0.5; 5 | 6 | .task-checkbox { 7 | --checkmark-color: #FFF; 8 | } 9 | } 10 | 11 | .task-checkbox { 12 | --size: 20px; 13 | --checkmark-width: 2px; 14 | --border-color: var(--ion-color-medium); 15 | --checkmark-color: var(--ion-color-medium); 16 | 17 | &::part(mark) { 18 | opacity: 1; 19 | } 20 | } 21 | 22 | .task-title { 23 | margin-left: 10px; 24 | font-size: 16px; 25 | font-weight: 500; 26 | color: var(--ion-color-dark-tint); 27 | } 28 | 29 | .task-content { 30 | display: flex; 31 | margin-top: 16px; 32 | align-items: center; 33 | justify-content: space-between; 34 | 35 | .task-owner-image { 36 | width: 35px; 37 | aspect-ratio: 1 / 1; 38 | 39 | img { 40 | border-radius: 50%; 41 | } 42 | } 43 | 44 | .task-due-date { 45 | margin-left: 12px; 46 | color: var(--ion-color-medium); 47 | } 48 | 49 | .task-icons { 50 | flex-grow: 2; 51 | text-align: right; 52 | color: var(--ion-color-medium); 53 | } 54 | 55 | .icon-number { 56 | vertical-align: middle; 57 | margin-left: 12px; 58 | margin-right: 3px; 59 | color: var(--ion-color-medium); 60 | } 61 | 62 | ion-icon { 63 | vertical-align: middle; 64 | } 65 | } 66 | } 67 | } 68 | 69 | 70 | .meetings-example { 71 | .meeting-wrapper { 72 | 73 | &.checkbox-checked { 74 | .meeting-card { 75 | --background: rgba(var(--card-color), 14%); 76 | } 77 | } 78 | 79 | .meeting-card { 80 | --background: rgba(var(--card-color), 3%); 81 | --custom-color: rgb(var(--card-color)); 82 | 83 | .meeting-card-content { 84 | border-left: var(--custom-color) solid 5px; 85 | 86 | .checkbox-col { 87 | align-self: center; 88 | text-align: center; 89 | --ion-grid-column-padding: 0px; 90 | 91 | ion-checkbox { 92 | --border-color: var(--custom-color); 93 | --background-checked: var(--custom-color); 94 | --border-color-checked: var(--custom-color); 95 | --checkmark-width: 2px; 96 | } 97 | 98 | .confirm-text { 99 | font-size: 11px; 100 | color: var(--custom-color); 101 | } 102 | } 103 | } 104 | 105 | .meeting-title { 106 | font-weight: bolder; 107 | } 108 | 109 | .followers-list { 110 | margin-top: 10px; 111 | display: flex; 112 | flex-direction: row-reverse; 113 | justify-content: flex-end; 114 | 115 | .follower-image-container { 116 | margin-right: -14px; 117 | flex: 0 0 20%; 118 | max-width: 45px; 119 | aspect-ratio: 1 / 1; 120 | 121 | .follower-image { 122 | border: solid 2px #fff; 123 | border-radius: 50%; 124 | } 125 | } 126 | } 127 | } 128 | } 129 | } 130 | 131 | .custom-checkboxes-example { 132 | .custom-checkbox { 133 | .checkbox-content { 134 | background: var(--img-src), rgba(0, 0, 0, .40); 135 | background-size: cover; 136 | background-blend-mode: overlay; 137 | display: flex; 138 | height: 100%; 139 | width: 100%; 140 | justify-content: space-between; 141 | aspect-ratio: 1 / 1; 142 | 143 | .checkbox-title { 144 | font-weight: 800; 145 | text-transform: uppercase; 146 | font-size: 24px; 147 | color: var(--ion-color-light); 148 | text-align: center; 149 | word-break: break-word; 150 | overflow: visible; 151 | position: absolute; 152 | width: 70%; 153 | left: 15%; 154 | // vertically centered 155 | top: 50%; 156 | transform: translateY(-50%); 157 | } 158 | 159 | .checkbox-item { 160 | --border-radius: 0px; 161 | --border-width: 10vw; 162 | --border-color: transparent; 163 | --border-color-checked: transparent; 164 | --background: transparent; 165 | --background-checked: rgba(var(--ion-color-secondary-rgb), .4); 166 | --checkmark-width: 2px; 167 | 168 | height: 100%; 169 | width: 100%; 170 | } 171 | } 172 | 173 | &.checkbox-checked { 174 | .checkbox-title { 175 | display: none; 176 | } 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /src/app/tab3/tab3.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { IonicModule } from '@ionic/angular'; 3 | 4 | import { Tab3Page } from './tab3.page'; 5 | 6 | describe('Tab3Page', () => { 7 | let component: Tab3Page; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(waitForAsync(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [Tab3Page], 13 | imports: [IonicModule.forRoot()] 14 | }).compileComponents(); 15 | 16 | fixture = TestBed.createComponent(Tab3Page); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | })); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /src/app/tab3/tab3.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-tab3', 5 | templateUrl: 'tab3.page.html', 6 | styleUrls: ['tab3.page.scss'] 7 | }) 8 | export class Tab3Page { 9 | constructor() {} 10 | } 11 | -------------------------------------------------------------------------------- /src/app/tab4/checkbox-checked.validator.ts: -------------------------------------------------------------------------------- 1 | import { ValidatorFn, FormArray } from '@angular/forms'; 2 | 3 | // this validator checks if we have at least X elements checked inside a FormArray Control 4 | export class CheckboxCheckedValidator { 5 | static minSelectedCheckboxes(min: number) { 6 | const validator: ValidatorFn = (formArray: FormArray) => { 7 | const totalSelected = formArray.controls 8 | // get a list of checkbox values (boolean) 9 | .map(control => control.value) 10 | // total up the number of checked checkboxes 11 | .reduce((prev, next) => next ? prev + next : prev, 0); 12 | 13 | // if the total is not greater than the minimum, return the error message 14 | return totalSelected >= min ? null : { required: true }; 15 | }; 16 | return validator; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/app/tab4/tab4-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { Tab4Page } from './tab4.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: '', 8 | component: Tab4Page, 9 | } 10 | ]; 11 | 12 | @NgModule({ 13 | imports: [RouterModule.forChild(routes)], 14 | exports: [RouterModule] 15 | }) 16 | export class Tab4PageRoutingModule {} 17 | -------------------------------------------------------------------------------- /src/app/tab4/tab4.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { NgModule } from '@angular/core'; 3 | import { CommonModule } from '@angular/common'; 4 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 5 | import { Tab4Page } from './tab4.page'; 6 | import { Tab4PageRoutingModule } from './tab4-routing.module'; 7 | import { CustomCheckboxModule } from '../custom-checkbox/custom-checkbox.module'; 8 | 9 | @NgModule({ 10 | imports: [ 11 | IonicModule, 12 | CommonModule, 13 | FormsModule, 14 | Tab4PageRoutingModule, 15 | ReactiveFormsModule, 16 | CustomCheckboxModule 17 | ], 18 | declarations: [Tab4Page] 19 | }) 20 | export class Tab4PageModule {} 21 | -------------------------------------------------------------------------------- /src/app/tab4/tab4.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Level #4 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Level #4 13 | 14 | 15 | 16 |
17 |

Add Angular Reactive Forms and Validators.

18 | 19 |

What are you interested in?

20 |

Select at least 2 options.

21 | 22 |
23 | 24 | 25 | 26 |
27 | {{interestsList[i].name}} 28 | 29 |
30 |
31 |
32 |
33 |
34 |
35 | 36 | {{ submitError }} 37 |
38 |
39 | SUBMIT 40 |
41 |
42 | 43 | {{ submitSuccess }} 44 |
45 |
46 |
47 |
48 |
49 | -------------------------------------------------------------------------------- /src/app/tab4/tab4.page.scss: -------------------------------------------------------------------------------- 1 | .custom-checkbox { 2 | 3 | .checkbox-content { 4 | background: var(--img-src), rgba(0, 0, 0, .40); 5 | background-size: cover; 6 | background-blend-mode: overlay; 7 | display: flex; 8 | height: 100%; 9 | width: 100%; 10 | justify-content: space-between; 11 | aspect-ratio: 1 / 1; 12 | 13 | .checkbox-title { 14 | font-weight: 800; 15 | text-transform: uppercase; 16 | font-size: 24px; 17 | color: var(--ion-color-light); 18 | text-align: center; 19 | word-break: break-word; 20 | overflow: visible; 21 | position: absolute; 22 | width: 70%; 23 | left: 15%; 24 | // vertically centered 25 | top: 50%; 26 | transform: translateY(-50%); 27 | } 28 | 29 | .checkbox-item { 30 | --border-radius: 0px; 31 | --border-width: 10vw; 32 | --border-color: transparent; 33 | --border-color-checked: transparent; 34 | --background: transparent; 35 | --background-checked: rgba(var(--ion-color-secondary-rgb), .4); 36 | --checkmark-width: 2px; 37 | 38 | height: 100%; 39 | width: 100%; 40 | } 41 | } 42 | 43 | &.checkbox-checked { 44 | .checkbox-title { 45 | display: none; 46 | } 47 | } 48 | } 49 | 50 | .interest-options { 51 | margin-bottom: 40px; 52 | } 53 | 54 | .error-message-container { 55 | .error-message { 56 | margin: 8px 0px; 57 | display: flex; 58 | align-items: center; 59 | color: var(--ion-color-danger); 60 | font-size: 18px; 61 | 62 | ion-icon { 63 | padding-inline-end: 4px; 64 | } 65 | } 66 | } 67 | 68 | .success-message-container { 69 | .success-message { 70 | margin: 8px 0px; 71 | display: flex; 72 | align-items: center; 73 | font-size: 18px; 74 | 75 | ion-icon { 76 | padding-inline-end: 4px; 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/app/tab4/tab4.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 2 | import { IonicModule } from '@ionic/angular'; 3 | 4 | import { Tab4Page } from './tab4.page'; 5 | 6 | describe('Tab4Page', () => { 7 | let component: Tab4Page; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(waitForAsync(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [Tab4Page], 13 | imports: [IonicModule.forRoot()] 14 | }).compileComponents(); 15 | 16 | fixture = TestBed.createComponent(Tab4Page); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | })); 20 | 21 | it('should create', () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /src/app/tab4/tab4.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { FormArray, FormControl, FormGroup } from '@angular/forms'; 3 | import { CheckboxCheckedValidator } from './checkbox-checked.validator'; 4 | 5 | @Component({ 6 | selector: 'app-tab4', 7 | templateUrl: 'tab4.page.html', 8 | styleUrls: ['tab4.page.scss'] 9 | }) 10 | export class Tab4Page { 11 | 12 | exampleForm: FormGroup; 13 | interestsList: any = [ 14 | { 15 | name: "Food", 16 | value: "food", 17 | image: 'url(https://images.pexels.com/photos/220911/pexels-photo-220911.jpeg?auto=compress&cs=tinysrgb)' 18 | }, 19 | { 20 | name: "Hike", 21 | value: "hike", 22 | image: 'url(https://images.pexels.com/photos/6102505/pexels-photo-6102505.jpeg?auto=compress&cs=tinysrgb)' 23 | }, 24 | { 25 | name: "Travel", 26 | value: "travel", 27 | image: 'url(https://images.pexels.com/photos/848573/pexels-photo-848573.jpeg?auto=compress&cs=tinysrgb)', 28 | selected: true 29 | }, 30 | { 31 | name: "Fashion", 32 | value: "fashion", 33 | image: 'url(https://images.pexels.com/photos/3568521/pexels-photo-3568521.jpeg?auto=compress&cs=tinysrgb)' 34 | } 35 | ]; 36 | submitError = 'Please select at least 2 options.'; 37 | submitSuccess: string; 38 | 39 | constructor() { 40 | this.exampleForm = new FormGroup({ 41 | // FormArray aggregates the values of each child FormControl into an array 42 | interests: new FormArray( 43 | // creates a FormControl for each 'Interest' from our interestsList 44 | // defined above and sets its selected value to 'true' or 'false' 45 | this.interestsList.map(x => new FormControl(x.selected)), 46 | // adds a custom validator that requires at least 2 checkboxes to be selected 47 | CheckboxCheckedValidator.minSelectedCheckboxes(2) 48 | ) 49 | }); 50 | 51 | this.exampleForm.get('interests').valueChanges 52 | .subscribe(values => { 53 | // reset the submitted values string 54 | this.submitSuccess = ''; 55 | }); 56 | } 57 | 58 | onSubmit() { 59 | const selectedInterests = []; 60 | 61 | this.exampleForm.value.interests 62 | .map((value: any, index: number) => { 63 | if (value) { 64 | selectedInterests.push(this.interestsList[index].name); 65 | } 66 | }); 67 | 68 | this.submitSuccess = 'Submitted values: ' + selectedInterests; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/app/tabs/tabs-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { TabsPage } from './tabs.page'; 4 | 5 | const routes: Routes = [ 6 | { 7 | path: 'tabs', 8 | component: TabsPage, 9 | children: [ 10 | { 11 | path: 'tab1', 12 | loadChildren: () => import('../tab1/tab1.module').then(m => m.Tab1PageModule) 13 | }, 14 | { 15 | path: 'tab2', 16 | loadChildren: () => import('../tab2/tab2.module').then(m => m.Tab2PageModule) 17 | }, 18 | { 19 | path: 'tab3', 20 | loadChildren: () => import('../tab3/tab3.module').then(m => m.Tab3PageModule) 21 | }, 22 | { 23 | path: 'tab4', 24 | loadChildren: () => import('../tab4/tab4.module').then(m => m.Tab4PageModule) 25 | }, 26 | { 27 | path: '', 28 | redirectTo: '/tabs/tab1', 29 | pathMatch: 'full' 30 | } 31 | ] 32 | }, 33 | { 34 | path: '', 35 | redirectTo: '/tabs/tab1', 36 | pathMatch: 'full' 37 | } 38 | ]; 39 | 40 | @NgModule({ 41 | imports: [RouterModule.forChild(routes)], 42 | }) 43 | export class TabsPageRoutingModule {} 44 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.module.ts: -------------------------------------------------------------------------------- 1 | import { IonicModule } from '@ionic/angular'; 2 | import { NgModule } from '@angular/core'; 3 | import { CommonModule } from '@angular/common'; 4 | import { FormsModule } from '@angular/forms'; 5 | 6 | import { TabsPageRoutingModule } from './tabs-routing.module'; 7 | 8 | import { TabsPage } from './tabs.page'; 9 | 10 | @NgModule({ 11 | imports: [ 12 | IonicModule, 13 | CommonModule, 14 | FormsModule, 15 | TabsPageRoutingModule 16 | ], 17 | declarations: [TabsPage] 18 | }) 19 | export class TabsPageModule {} 20 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Level 1 7 | 8 | 9 | 10 | 11 | Level 2 12 | 13 | 14 | 15 | 16 | Level 3 17 | 18 | 19 | 20 | 21 | Level 4 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.page.scss: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.page.spec.ts: -------------------------------------------------------------------------------- 1 | import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; 2 | import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; 3 | 4 | import { TabsPage } from './tabs.page'; 5 | 6 | describe('TabsPage', () => { 7 | let component: TabsPage; 8 | let fixture: ComponentFixture; 9 | 10 | beforeEach(waitForAsync(() => { 11 | TestBed.configureTestingModule({ 12 | declarations: [TabsPage], 13 | schemas: [CUSTOM_ELEMENTS_SCHEMA], 14 | }).compileComponents(); 15 | })); 16 | 17 | beforeEach(() => { 18 | fixture = TestBed.createComponent(TabsPage); 19 | component = fixture.componentInstance; 20 | fixture.detectChanges(); 21 | }); 22 | 23 | it('should create', () => { 24 | expect(component).toBeTruthy(); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /src/app/tabs/tabs.page.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-tabs', 5 | templateUrl: 'tabs.page.html', 6 | styleUrls: ['tabs.page.scss'] 7 | }) 8 | export class TabsPage { 9 | 10 | constructor() {} 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/assets/icon/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ionicthemes/how-to-build-any-ui-with-ionic/448ea7e658fb72ee46ef488ef247dad3976a814e/src/assets/icon/favicon.png -------------------------------------------------------------------------------- /src/assets/shapes.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /src/global.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * App Global CSS 3 | * ---------------------------------------------------------------------------- 4 | * Put style rules here that you want to apply globally. These styles are for 5 | * the entire app and not just one component. Additionally, this file can be 6 | * used as an entry point to import other CSS/Sass files to be included in the 7 | * output CSS. 8 | * For more information on global stylesheets, visit the documentation: 9 | * https://ionicframework.com/docs/layout/global-stylesheets 10 | */ 11 | 12 | /* Core CSS required for Ionic components to work properly */ 13 | @import "~@ionic/angular/css/core.css"; 14 | 15 | /* Basic CSS for apps built with Ionic */ 16 | @import "~@ionic/angular/css/normalize.css"; 17 | @import "~@ionic/angular/css/structure.css"; 18 | @import "~@ionic/angular/css/typography.css"; 19 | @import '~@ionic/angular/css/display.css'; 20 | 21 | /* Optional CSS utils that can be commented out */ 22 | @import "~@ionic/angular/css/padding.css"; 23 | @import "~@ionic/angular/css/float-elements.css"; 24 | @import "~@ionic/angular/css/text-alignment.css"; 25 | @import "~@ionic/angular/css/text-transformation.css"; 26 | @import "~@ionic/angular/css/flex-utils.css"; 27 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ionic App 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | import './zone-flags'; 56 | 57 | /*************************************************************************************************** 58 | * Zone JS is required by default for Angular itself. 59 | */ 60 | import 'zone.js/dist/zone'; // Included with Angular CLI. 61 | 62 | 63 | /*************************************************************************************************** 64 | * APPLICATION IMPORTS 65 | */ 66 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/theming/ 3 | 4 | /** Ionic CSS Variables **/ 5 | :root { 6 | /** primary **/ 7 | --ion-color-primary: #3880ff; 8 | --ion-color-primary-rgb: 56, 128, 255; 9 | --ion-color-primary-contrast: #ffffff; 10 | --ion-color-primary-contrast-rgb: 255, 255, 255; 11 | --ion-color-primary-shade: #3171e0; 12 | --ion-color-primary-tint: #4c8dff; 13 | 14 | /** secondary **/ 15 | --ion-color-secondary: #3dc2ff; 16 | --ion-color-secondary-rgb: 61, 194, 255; 17 | --ion-color-secondary-contrast: #ffffff; 18 | --ion-color-secondary-contrast-rgb: 255, 255, 255; 19 | --ion-color-secondary-shade: #36abe0; 20 | --ion-color-secondary-tint: #50c8ff; 21 | 22 | /** tertiary **/ 23 | --ion-color-tertiary: #5260ff; 24 | --ion-color-tertiary-rgb: 82, 96, 255; 25 | --ion-color-tertiary-contrast: #ffffff; 26 | --ion-color-tertiary-contrast-rgb: 255, 255, 255; 27 | --ion-color-tertiary-shade: #4854e0; 28 | --ion-color-tertiary-tint: #6370ff; 29 | 30 | /** success **/ 31 | --ion-color-success: #2dd36f; 32 | --ion-color-success-rgb: 45, 211, 111; 33 | --ion-color-success-contrast: #ffffff; 34 | --ion-color-success-contrast-rgb: 255, 255, 255; 35 | --ion-color-success-shade: #28ba62; 36 | --ion-color-success-tint: #42d77d; 37 | 38 | /** warning **/ 39 | --ion-color-warning: #ffc409; 40 | --ion-color-warning-rgb: 255, 196, 9; 41 | --ion-color-warning-contrast: #000000; 42 | --ion-color-warning-contrast-rgb: 0, 0, 0; 43 | --ion-color-warning-shade: #e0ac08; 44 | --ion-color-warning-tint: #ffca22; 45 | 46 | /** danger **/ 47 | --ion-color-danger: #eb445a; 48 | --ion-color-danger-rgb: 235, 68, 90; 49 | --ion-color-danger-contrast: #ffffff; 50 | --ion-color-danger-contrast-rgb: 255, 255, 255; 51 | --ion-color-danger-shade: #cf3c4f; 52 | --ion-color-danger-tint: #ed576b; 53 | 54 | /** dark **/ 55 | --ion-color-dark: #222428; 56 | --ion-color-dark-rgb: 34, 36, 40; 57 | --ion-color-dark-contrast: #ffffff; 58 | --ion-color-dark-contrast-rgb: 255, 255, 255; 59 | --ion-color-dark-shade: #1e2023; 60 | --ion-color-dark-tint: #383a3e; 61 | 62 | /** medium **/ 63 | --ion-color-medium: #92949c; 64 | --ion-color-medium-rgb: 146, 148, 156; 65 | --ion-color-medium-contrast: #ffffff; 66 | --ion-color-medium-contrast-rgb: 255, 255, 255; 67 | --ion-color-medium-shade: #808289; 68 | --ion-color-medium-tint: #9d9fa6; 69 | 70 | /** light **/ 71 | --ion-color-light: #f4f5f8; 72 | --ion-color-light-rgb: 244, 245, 248; 73 | --ion-color-light-contrast: #000000; 74 | --ion-color-light-contrast-rgb: 0, 0, 0; 75 | --ion-color-light-shade: #d7d8da; 76 | --ion-color-light-tint: #f5f6f9; 77 | } 78 | 79 | @media (prefers-color-scheme: dark) { 80 | /* 81 | * Dark Colors 82 | * ------------------------------------------- 83 | */ 84 | 85 | body { 86 | --ion-color-primary: #428cff; 87 | --ion-color-primary-rgb: 66,140,255; 88 | --ion-color-primary-contrast: #ffffff; 89 | --ion-color-primary-contrast-rgb: 255,255,255; 90 | --ion-color-primary-shade: #3a7be0; 91 | --ion-color-primary-tint: #5598ff; 92 | 93 | --ion-color-secondary: #50c8ff; 94 | --ion-color-secondary-rgb: 80,200,255; 95 | --ion-color-secondary-contrast: #ffffff; 96 | --ion-color-secondary-contrast-rgb: 255,255,255; 97 | --ion-color-secondary-shade: #46b0e0; 98 | --ion-color-secondary-tint: #62ceff; 99 | 100 | --ion-color-tertiary: #6a64ff; 101 | --ion-color-tertiary-rgb: 106,100,255; 102 | --ion-color-tertiary-contrast: #ffffff; 103 | --ion-color-tertiary-contrast-rgb: 255,255,255; 104 | --ion-color-tertiary-shade: #5d58e0; 105 | --ion-color-tertiary-tint: #7974ff; 106 | 107 | --ion-color-success: #2fdf75; 108 | --ion-color-success-rgb: 47,223,117; 109 | --ion-color-success-contrast: #000000; 110 | --ion-color-success-contrast-rgb: 0,0,0; 111 | --ion-color-success-shade: #29c467; 112 | --ion-color-success-tint: #44e283; 113 | 114 | --ion-color-warning: #ffd534; 115 | --ion-color-warning-rgb: 255,213,52; 116 | --ion-color-warning-contrast: #000000; 117 | --ion-color-warning-contrast-rgb: 0,0,0; 118 | --ion-color-warning-shade: #e0bb2e; 119 | --ion-color-warning-tint: #ffd948; 120 | 121 | --ion-color-danger: #ff4961; 122 | --ion-color-danger-rgb: 255,73,97; 123 | --ion-color-danger-contrast: #ffffff; 124 | --ion-color-danger-contrast-rgb: 255,255,255; 125 | --ion-color-danger-shade: #e04055; 126 | --ion-color-danger-tint: #ff5b71; 127 | 128 | --ion-color-dark: #f4f5f8; 129 | --ion-color-dark-rgb: 244,245,248; 130 | --ion-color-dark-contrast: #000000; 131 | --ion-color-dark-contrast-rgb: 0,0,0; 132 | --ion-color-dark-shade: #d7d8da; 133 | --ion-color-dark-tint: #f5f6f9; 134 | 135 | --ion-color-medium: #989aa2; 136 | --ion-color-medium-rgb: 152,154,162; 137 | --ion-color-medium-contrast: #000000; 138 | --ion-color-medium-contrast-rgb: 0,0,0; 139 | --ion-color-medium-shade: #86888f; 140 | --ion-color-medium-tint: #a2a4ab; 141 | 142 | --ion-color-light: #222428; 143 | --ion-color-light-rgb: 34,36,40; 144 | --ion-color-light-contrast: #ffffff; 145 | --ion-color-light-contrast-rgb: 255,255,255; 146 | --ion-color-light-shade: #1e2023; 147 | --ion-color-light-tint: #383a3e; 148 | } 149 | 150 | /* 151 | * iOS Dark Theme 152 | * ------------------------------------------- 153 | */ 154 | 155 | .ios body { 156 | --ion-background-color: #000000; 157 | --ion-background-color-rgb: 0,0,0; 158 | 159 | --ion-text-color: #ffffff; 160 | --ion-text-color-rgb: 255,255,255; 161 | 162 | --ion-color-step-50: #0d0d0d; 163 | --ion-color-step-100: #1a1a1a; 164 | --ion-color-step-150: #262626; 165 | --ion-color-step-200: #333333; 166 | --ion-color-step-250: #404040; 167 | --ion-color-step-300: #4d4d4d; 168 | --ion-color-step-350: #595959; 169 | --ion-color-step-400: #666666; 170 | --ion-color-step-450: #737373; 171 | --ion-color-step-500: #808080; 172 | --ion-color-step-550: #8c8c8c; 173 | --ion-color-step-600: #999999; 174 | --ion-color-step-650: #a6a6a6; 175 | --ion-color-step-700: #b3b3b3; 176 | --ion-color-step-750: #bfbfbf; 177 | --ion-color-step-800: #cccccc; 178 | --ion-color-step-850: #d9d9d9; 179 | --ion-color-step-900: #e6e6e6; 180 | --ion-color-step-950: #f2f2f2; 181 | 182 | --ion-item-background: #000000; 183 | 184 | --ion-card-background: #1c1c1d; 185 | } 186 | 187 | .ios ion-modal { 188 | --ion-background-color: var(--ion-color-step-100); 189 | --ion-toolbar-background: var(--ion-color-step-150); 190 | --ion-toolbar-border-color: var(--ion-color-step-250); 191 | } 192 | 193 | 194 | /* 195 | * Material Design Dark Theme 196 | * ------------------------------------------- 197 | */ 198 | 199 | .md body { 200 | --ion-background-color: #121212; 201 | --ion-background-color-rgb: 18,18,18; 202 | 203 | --ion-text-color: #ffffff; 204 | --ion-text-color-rgb: 255,255,255; 205 | 206 | --ion-border-color: #222222; 207 | 208 | --ion-color-step-50: #1e1e1e; 209 | --ion-color-step-100: #2a2a2a; 210 | --ion-color-step-150: #363636; 211 | --ion-color-step-200: #414141; 212 | --ion-color-step-250: #4d4d4d; 213 | --ion-color-step-300: #595959; 214 | --ion-color-step-350: #656565; 215 | --ion-color-step-400: #717171; 216 | --ion-color-step-450: #7d7d7d; 217 | --ion-color-step-500: #898989; 218 | --ion-color-step-550: #949494; 219 | --ion-color-step-600: #a0a0a0; 220 | --ion-color-step-650: #acacac; 221 | --ion-color-step-700: #b8b8b8; 222 | --ion-color-step-750: #c4c4c4; 223 | --ion-color-step-800: #d0d0d0; 224 | --ion-color-step-850: #dbdbdb; 225 | --ion-color-step-900: #e7e7e7; 226 | --ion-color-step-950: #f3f3f3; 227 | 228 | --ion-item-background: #1e1e1e; 229 | 230 | --ion-toolbar-background: #1f1f1f; 231 | 232 | --ion-tab-bar-background: #1f1f1f; 233 | 234 | --ion-card-background: #1e1e1e; 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /src/zone-flags.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Prevents Angular change detection from 3 | * running with certain Web Component callbacks 4 | */ 5 | // eslint-disable-next-line no-underscore-dangle 6 | (window as any).__Zone_disable_customElements = true; 7 | -------------------------------------------------------------------------------- /tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "sourceMap": true, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "module": "es2020", 15 | "lib": ["es2018", "dom"] 16 | }, 17 | "angularCompilerOptions": { 18 | "enableI18nLegacyMessageIdFormat": false, 19 | "strictInjectionParameters": true, 20 | "strictInputAccessModifiers": true, 21 | "strictTemplates": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | --------------------------------------------------------------------------------