|
| 1 | +# ngx-typed2 |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +[](https://github.com/shiv-source/ngx-typed2/pulls) |
| 8 | + |
| 9 | +ngx-typed2 is an Angular library designed to seamlessly integrate Typed.js functionalities into Angular applications, compatible with both Single Page Applications (SPA) and Server-Side Rendering (SSR) |
| 10 | + |
| 11 | +## Installation |
| 12 | + |
| 13 | +You can install ngx-typed2 via npm: |
| 14 | + |
| 15 | +```bash |
| 16 | +npm install ngx-typed2 |
| 17 | +``` |
| 18 | + |
| 19 | +You can install ngx-typed2 via yarn: |
| 20 | + |
| 21 | +```bash |
| 22 | +yarn add ngx-typed2 |
| 23 | +``` |
| 24 | + |
| 25 | + |
| 26 | +You can install ngx-typed2 via pnpm: |
| 27 | + |
| 28 | +```bash |
| 29 | +pnpm add ngx-typed2 |
| 30 | +``` |
| 31 | + |
| 32 | +## Usage |
| 33 | + |
| 34 | +### Import the Module |
| 35 | + |
| 36 | +Import the `NgxTypedJsModule` into your Angular module: |
| 37 | + |
| 38 | +```typescript |
| 39 | +import { NgxTypedJsModule } from 'ngx-typed2'; |
| 40 | + |
| 41 | +@NgModule({ |
| 42 | + imports: [ |
| 43 | + NgxTypedJsModule |
| 44 | + ] |
| 45 | +}) |
| 46 | +export class AppModule { } |
| 47 | +``` |
| 48 | + |
| 49 | +### Use in the Component |
| 50 | + |
| 51 | +Use the `ngx-typed2` component in your Angular templates: |
| 52 | + |
| 53 | +```html |
| 54 | +<ngx-typed2 |
| 55 | + [strings]="['Hello', 'World']" |
| 56 | + typeSpeed="50" |
| 57 | + backSpeed="30" |
| 58 | + [loop]="false" |
| 59 | + [showCursor]="true" |
| 60 | + cursorChar="|" |
| 61 | + [autoInsertCss]="true" |
| 62 | +></ngx-typed2> |
| 63 | +``` |
| 64 | + |
| 65 | +### Available Inputs |
| 66 | + |
| 67 | +| Input | Type | Default | Description | |
| 68 | +|----------------------|--------------|-------------|------------------------------------------------------| |
| 69 | +| strings | string[] | [] | Array of strings to be typed out sequentially. | |
| 70 | +| stringsElement | string | undefined | String element to be typed out. | |
| 71 | +| typeSpeed | number | 100 | Typing speed (in milliseconds per character). | |
| 72 | +| startDelay | number | undefined | Delay before typing starts (in milliseconds). | |
| 73 | +| backSpeed | number | 100 | Backspacing speed (in milliseconds per character). | |
| 74 | +| smartBackspace | boolean | undefined | Enable smart backspacing for natural typing effects. | |
| 75 | +| shuffle | boolean | undefined | Enable random string selection. | |
| 76 | +| backDelay | number | 500 | Delay between characters during backspacing. | |
| 77 | +| fadeOut | boolean | undefined | Enable fade-out effect. | |
| 78 | +| fadeOutClass | string | undefined | CSS class for fade-out effect. | |
| 79 | +| fadeOutDelay | number | 500 | Delay before fade-out (in milliseconds). | |
| 80 | +| loop | boolean | true | Control looping of typing animation. | |
| 81 | +| loopCount | number | undefined | Specify the number of loop counts. | |
| 82 | +| showCursor | boolean | undefined | Toggle cursor visibility. | |
| 83 | +| cursorChar | string | undefined | Customize cursor appearance. | |
| 84 | +| autoInsertCss | boolean | undefined | Automatically insert Typed.js CSS. | |
| 85 | +| attr | string | undefined | Additional attributes. | |
| 86 | +| bindInputFocusEvents | boolean | undefined | Bind input focus events. | |
| 87 | +| contentType | string | undefined | Specify content type (e.g., 'html', 'text'). | |
| 88 | +| cursorColor | string | undefined | Customize cursor color. | |
| 89 | +| ngClass | string | undefined | Apply custom classes. | |
| 90 | + |
| 91 | + |
| 92 | +### Available Outputs |
| 93 | + |
| 94 | + |
| 95 | +| Output | Event Emitted Data | Description | |
| 96 | +|-------------------------|-------------------------------------------------|----------------------------------------------------------| |
| 97 | +| onBeginEvent | Typed | Triggered when typing begins. | |
| 98 | +| onCompleteEvent | Typed | Triggered when typing completes. | |
| 99 | +| preStringTypedEvent | { arrayPos: number, self: Typed } | Triggered before a string is typed. | |
| 100 | +| onStringTypedEvent | { arrayPos: number, self: Typed } | Triggered after a string is typed. | |
| 101 | +| onLastStringBackspacedEvent | Typed | Triggered when the last string is backspaced. | |
| 102 | +| onTypingPausedEvent | { arrayPos: number, self: Typed } | Triggered when typing is paused. | |
| 103 | +| onTypingResumedEvent | { arrayPos: number, self: Typed } | Triggered when typing resumes after being paused. | |
| 104 | +| onResetEvent | Typed | Triggered when typing is reset. | |
| 105 | +| onStopEvent | { arrayPos: number, self: Typed } | Triggered when typing is stopped. | |
| 106 | +| onStartEvent | { arrayPos: number, self: Typed } | Triggered when typing starts for a particular string. | |
| 107 | +| onDestroyEvent | Typed | Triggered when the ngx-typed2 instance is destroyed. | |
| 108 | + |
| 109 | + |
| 110 | +### Available Methods |
| 111 | + |
| 112 | +| Method | Description | |
| 113 | +|-----------|---------------------------------------------------| |
| 114 | +| start() | Initiates the typing animation. | |
| 115 | +| stop() | Pauses the typing animation. | |
| 116 | +| reset() | Resets the typing animation to its initial state. | |
| 117 | +| toggle() | Toggles between starting and stopping the typing animation. | |
| 118 | +| destroy() | Stops the typing animation and cleans up any resources used. | |
| 119 | + |
| 120 | + |
| 121 | +## License |
| 122 | + |
| 123 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 124 | + |
| 125 | + |
| 126 | +## Contact |
| 127 | + |
| 128 | +- **Author:** Shiv Kumar |
| 129 | +- **Website:** [https://shivkumar.me](https://shivkumar.me) |
| 130 | +- **Email:** [hello@shivkumar.me](mailto:hello@shivkumar.me) |
| 131 | +- **Issue Tracker:** [GitHub Issues](https://github.com/shiv-source/ngx-typed2/issues) |
0 commit comments