Class TableHeaderCell

All Implemented Interfaces:
AttachNotifier, ClickNotifier<TableHeaderCell>, DetachNotifier, HasComponents, HasComponentsOfType<Component>, HasElement, HasEnabled, HasSize, HasStyle, HasText, Serializable

@NullMarked @Tag("th") public class TableHeaderCell extends TableCell implements 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:
  • Constructor Details

    • TableHeaderCell

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

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

      public TableHeaderCell(List<? extends 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(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:
  • 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).