com.vaadin.flow.component.

Class Text

  • All Implemented Interfaces:

    AttachNotifier, DetachNotifier, HasElement, HasText, Serializable


    public class Text
    extends Component
    implements HasText

    A component which encapsulates the given text in a text node.

    Text node doesn't support setting any attribute or property so you may not use Element API (and Text doesn't provide any such contract) for setting attribute/property. It implies that you may not style this component as well. Any attempt to set attribute/property value throws an exception. The only available API for a Text component is set a text.

    If you need a text component which can be styled then check Span class (from flow-html-components) module.

    Since:

    1.0

    Author:

    Vaadin Ltd

    See Also:

    Serialized Form

    • Constructor Detail

      • Text

        public Text(String text)

        Creates an instance using the given text.

        Parameters:

        text - the text to show, not null