Ellipsis
Text inside an HTML element can be truncated easily with an ellipsis by using CSS. To make this even easier, you can use the EllipsisDirective
which has been exposed by the @abp/ng.theme.shared
package.
Getting Started
In order to use the EllipsisDirective
in an HTML template, the ThemeSharedModule
should be imported into your module like this:
or if you would not like to import the ThemeSharedModule
, you can import the EllipsisModule
as shown below:
Usage
The EllipsisDirective
is very easy to use. The directive's selector is abpEllipsis
. By adding the abpEllipsis
attribute to an HTML element, you can activate the EllipsisDirective
for the HTML element.
See an example usage:
The abpEllipsis
attribute has been added to the <p>
element that containing very long text inside to activate the EllipsisDirective
.
See the result:
The long text has been truncated by using the directive.
The UI before using the directive looks like this:
Specifying Max Width of an HTML Element
An HTML element max width can be specified as shown below:
See the result: