@chitovas/ngx-clamp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @chitova/ngx-clamp
|
|
2
|
+
|
|
3
|
+
Welcome to @chitova/ngx-clamp, an Angular library designed to elegantly manage text overflow within HTML elements. This library allows you to clamp text, adding ellipsis or a truncation text of your choice when the content exceeds a specified height.
|
|
4
|
+
|
|
5
|
+
# Motivation
|
|
6
|
+
|
|
7
|
+
Solves overflow issues on older legacy browsers that don't support the `-webkit-line-clamp` or `line-clamp` property, ensuring consistent behavior across different platforms.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Easy Integration**: Seamlessly integrate `ngx-clamp` directive into your Angular applications to manage text overflow.
|
|
12
|
+
- **Customizable Truncation**: Use ellipsis or specify your own truncation text for clamped content.
|
|
13
|
+
- **Nested Element Support**: Clamp text within nested HTML elements effortlessly.
|
|
14
|
+
- **Height Configuration**: Set a maximum height for text before clamping activates.
|
|
15
|
+
- **Legacy Browser Compatibility**: Solves overflow issues on older browsers that don't support the -webkit-line-clamp property, ensuring consistent behavior across different platforms.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Install the package using npm:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @chitova/ngx-clamp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { NgxClamp } from '@chitova/ngx-clamp';
|
|
29
|
+
|
|
30
|
+
@Component({
|
|
31
|
+
selector: 'my-component',
|
|
32
|
+
template: `
|
|
33
|
+
<div ngxClamp [maxHeight]="100" truncationText="...">
|
|
34
|
+
Your long text goes here, and it will be clamped if it exceeds the specified height.
|
|
35
|
+
<p>Your long text goes here in nested element</p>
|
|
36
|
+
</div>
|
|
37
|
+
<div ngxClamp [maxHeight]="150" truncationText="Read more...">
|
|
38
|
+
This is a longer paragraph that will be clamped to fit within the specified height.
|
|
39
|
+
</div>
|
|
40
|
+
`,
|
|
41
|
+
imports: [NgxClamp],
|
|
42
|
+
})
|
|
43
|
+
export class MyComponent {}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
@chitova/ngx-clamp is released under the MIT License.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chitovas/ngx-clamp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"author": "Nigel Mukandi",
|
|
5
5
|
"description": "angular library designed to elegantly manage text overflow within HTML elements. This library allows you to clamp text, adding ellipsis or a truncation text of your choice when the content exceeds a specified height.",
|
|
6
6
|
"repository": {
|