A library that displays the last text with a Show More button attached when the number of lines to be printed is exceeded.
You can check out the demo here.
npm install --save text-line-clampimport {
FormsModule
} from '@angular/forms'
import {
CommonModule
} from '@angular/common'
import {
TextLineClampModule or TextLineClampComponent
} from 'text-line-clamp'
@Component( {
imports: [
FormsModule,
CommonModule,
TextLineClampModule or TextLineClampComponent
],
standalone: true,
selector: 'app-my-component',
template: '<text-line-clamp [text]="text" [clamp]="2" [buttonName]="\'...More\'" [buttonColor]="\'#999\'"></text-line-clamp>'
} )
export class MyComponent {
public text: string = 'Please enter the text content.'
}| Name | Type | Description | Default |
|---|---|---|---|
| [clamp] | number | Number of line breaks to show the Show More button | 2 |
| [buttonName] | string | Show more button title | ...More |
| [buttonColor] | string | Show more button color | #999 |
1.0.0 : Initial release.
1.0.1 : Changed from word wrapping to character wrapping.
1.0.2 : Standalone / SSR compatible.
MIT
