Class TableHeaderCell

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.TableCell
com.vaadin.flow.component.html.TableHeaderCell
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<TableHeaderCell>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, Serializable

@NullMarked @Tag("th") public class TableHeaderCell extends TableCell implements com.vaadin.flow.component.ClickNotifier<TableHeaderCell>
Component representing a <th> element — a header cell that labels a row or a column of a Table.
Since:
25.3
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Defines the cells that a <th> header relates to — effectively the answer to "which other cells does this header label?".

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText

    com.vaadin.flow.component.HasText.WhiteSpace
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new empty header cell.
    TableHeaderCell(com.vaadin.flow.component.Component... components)
    Creates a new header cell with the given children.
    TableHeaderCell(com.vaadin.flow.signals.Signal<String> textSignal)
    Creates a new header cell with its text content bound to the given signal.
    Creates a new header cell with the given text.
    TableHeaderCell(List<? extends com.vaadin.flow.component.Component> components)
    List equivalent of TableHeaderCell(Component...).
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the scope attribute value, if set.
    void
    Sets the scope attribute, declaring which cells this header labels.

    Methods inherited from class com.vaadin.flow.component.HtmlComponent

    getTitle, setTitle

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttached

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add

    Methods inherited from interface com.vaadin.flow.component.HasComponentsOfType

    add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, getComponentCount, indexOf, remove, remove, removeAll, replace

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    bindEnabled, isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasSize

    bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasText

    bindText, getText, getWhiteSpace, setText, setWhiteSpace
  • Constructor Details

    • TableHeaderCell

      public TableHeaderCell()
      Creates a new empty header cell.
    • TableHeaderCell

      public TableHeaderCell(com.vaadin.flow.component.Component... components)
      Creates a new header cell with the given children.
      Parameters:
      components - the children components.
    • TableHeaderCell

      public TableHeaderCell(List<? extends com.vaadin.flow.component.Component> components)
      List equivalent of TableHeaderCell(Component...).
      Parameters:
      components - the children components.
    • TableHeaderCell

      public TableHeaderCell(String text)
      Creates a new header cell with the given text.
      Parameters:
      text - the text.
    • TableHeaderCell

      public TableHeaderCell(com.vaadin.flow.signals.Signal<String> textSignal)
      Creates a new header cell with its text content bound to the given signal.
      Parameters:
      textSignal - the signal to bind, not null
      See Also:
      • HasText.bindText(Signal)
  • Method Details

    • setScope

      public void setScope(@Nullable TableHeaderCell.Scope scope)
      Sets the scope attribute, declaring which cells this header labels. Critical for accessibility — screen readers use this to announce the right header when a user navigates into a data cell. Pass null to remove the attribute (browsers will then infer scope from structure).
      Parameters:
      scope - the scope, or null to clear the attribute.
      See Also:
    • getScope

      public Optional<TableHeaderCell.Scope> getScope()
      Returns the scope attribute value, if set.
      Returns:
      the scope wrapped in an Optional, or empty if unset (or the value is unrecognized).