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 hyphens
Property change event hyphensChanged
Property 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 lineClamp
Property change event lineClampChanged
Property 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 overflowWrap
Property change event overflowWrapChanged
Property 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 size
Property change event sizeChanged
Property 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 truncation
Property change event truncationChanged
Property 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 value
Property change event valueChanged
Property 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 variant
Property change event variantChanged
Property 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 weight
Property change event weightChanged
Property 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 property
string 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 properties
object 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 property
string The property name to set. Supports dot notation for subproperty access. value
any The new value to set the property to. Returns:
- Type
- void