Usage
Signature:
interface CTruncatingTextElement
Typescript Import Format
//To typecheck the element APIs, import as below.
import { CTruncatingTextElement } from "oj-c/truncating-text";
//For the transpiled javascript to load the element's module, import as below
import "oj-c/truncating-text";
For additional information visit:
Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Attributes
-
hyphens :"auto"|"none"
-
Specifies if hyphens should be included when handling long words with no spaces.
Names
Item Name Property hyphensProperty change event hyphensChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-hyphens-changed -
line-clamp :number
-
Truncates text at a specific number of lines and then displays an ellipsis (…) at the end of the last line. Parent of the element needs to have a specific width so text starts overflowing and produce a truncation.
Names
Item Name Property lineClampProperty change event lineClampChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-line-clamp-changed -
overflow-wrap :"normal"|"anywhere"|"breakWord"
-
Specifies the overflow-wrap.
Names
Item Name Property overflowWrapProperty change event overflowWrapChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-overflow-wrap-changed -
size :"inherit"|"sm"|"md"|"lg"|"xs"|"2xs"|"xl"
-
Specifies font size and line height. If set as 'inherit', takes font size and line height from its parent element.
Names
Item Name Property sizeProperty change event sizeChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-size-changed -
truncation :"none"|"clip"|"ellipsis"
-
Determines text behavior when text is truncated. Be aware of setting either lineClamp or truncation. Setting both props would produce a type error. In most cases, lineClamp=1 tries to put the ellipsis at the end of a "word". On the other hand, using truncation="ellipsis" will show as much as possible text, then put the ellipsis at the end.
Names
Item Name Property truncationProperty change event truncationChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-truncation-changed -
value* :string
-
"Specifies the text to be displayed.
Names
Item Name Property valueProperty change event valueChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-value*-changed -
variant :"inherit"|"disabled"|"success"|"danger"|"warning"|"primary"|"secondary"
-
Specifies text color. If set as 'inherit', takes text color from its parent element.
Names
Item Name Property variantProperty change event variantChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-variant-changed -
weight :"bold"|"normal"|"inherit"|"semiBold"
-
Specifies the font weight. If set as 'inherit', takes font weight from its parent element.
Names
Item Name Property weightProperty change event weightChangedProperty change listener attribute (must be of type function, see Events and Listeners for additional information.) on-weight-changed
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty.
Parameters:
Name Type Description propertystring The property name to get. Supports dot notation for subproperty access. Returns:
- Type
- any
-
setProperties(properties) : {void}
-
Performs a batch set of properties.
Parameters:
Name Type Description propertiesobject An object containing the property and value pairs to set. Returns:
- Type
- void
-
setProperty(property, value) : {void}
-
Sets a property or a single subproperty for complex properties and notifies the component of the change, triggering a corresponding event.
Parameters:
Name Type Description propertystring The property name to set. Supports dot notation for subproperty access. valueany The new value to set the property to. Returns:
- Type
- void