Skip to content

Node fields as components #16580

Open

Description

@wrench32

What problem does this solve or what need does it fill?

In Bevy 0.15, Node's properties like background_color were converted into components, making them easy to override after node creation. However, properties like grid_auto_rows are not components, making it harder to override them after spawning. This inconsistency increases boilerplate when passing all style properties to helper functions, especially if only a few need to be modified.

What solution would you like?

Make all style properties (like grid_auto_rows, grid_row, grid_column) components, as background_color is now. This would allow properties to be overridden after node creation.

What alternative(s) have you considered?

An alternative is to pass all style properties explicitly, even if they aren’t overridden, which leads to unnecessary verbosity. Another approach is modifying node styles directly after creation, but this adds extra steps.

Additional information

A similar thing happens with components that store more than one field like TextFont. If you wish to override only the font size, you have to override the entire component, providing the font file again.

Activity

  1. added
    C-FeatureA new feature, making something new possible
    S-Needs-TriageThis issue needs to be labelled
    on Dec 1, 2024
  2. added
    A-UIGraphical user interfaces, styles, layouts, and widgets
    C-UsabilityA targeted quality-of-life change that makes Bevy easier to use
    X-Needs-SMEThis type of work requires an SME to approve it.
    and removed
    C-FeatureA new feature, making something new possible
    S-Needs-TriageThis issue needs to be labelled
    on Dec 1, 2024
  3. added
    S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!
    D-ModestA "normal" level of difficulty; suitable for simple features or challenging fixes
    on Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ModestA "normal" level of difficulty; suitable for simple features or challenging fixesS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!X-Needs-SMEThis type of work requires an SME to approve it.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions