Package org.patternfly.component.truncate


package org.patternfly.component.truncate
Provides a truncate component for shortening long text with an ellipsis.

The truncate component shortens text that overflows its container, showing an ellipsis at the end, middle, or start of the text. A tooltip with the full text is shown on hover.

Key Classes

Usage

Truncate text at different positions:

import static org.patternfly.component.truncate.Truncate.truncate;
import static org.patternfly.component.truncate.TruncatePosition.middle;
import static org.patternfly.component.truncate.TruncatePosition.start;

// Default truncation (at the end)
Truncate endTruncate = truncate("This is a very long text that will be truncated at the end");

// Truncation in the middle (useful for file names)
Truncate middleTruncate = truncate("redhat_logo_black_and_white_reversed_simple.zip", middle);

// Truncation at the start
Truncate startTruncate = truncate("This is a very long text that will be truncated at the start", start);
See Also:
  • Class
    Description
    A truncate is a tool used to shorten numeric and non-numeric character strings, typically when the string overflows its container.