Skip to content

[Blazor] Optional constraint to component nesting (UI warning/Compilation error) #31175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rafaelchampion opened this issue Mar 24, 2021 · 1 comment
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved

Comments

@rafaelchampion
Copy link

In DevExpress they have a nice touch to their components where:

  • Sub-components may only be nested within a specific parent component
  • A parent component may only nest a defined list of components

This is shown as an UI warning much like when you try to nest a 'div' inside an 'ul'.

E.g.:

In the ASPxGridView component, Columns is a valid nestable child component:

<dx:ASPxGridView runat="server">
      <Columns></Columns>
</dx:ASPxGridView>

In comparison, if we try to nest an Items component (nestable within other components like ASPxComboBox, but not within ASPxGridView) or any other component/tag, like this:

<dx:ASPxGridView runat="server">
        <Items></Items>
</dx:ASPxGridView>

The UI displays a warning: Element 'Items' not supported.

Similarly, it's not possible to use a standalone Columns component outside an ASPxGridView component.

It would be nice to be able to:

  • Declare a specific list of components to be nestable inside a parent component
    and/or
  • Specify that a component may only be usable if nested inside a specific component/list of components

This allows a child component to only be used where it's strictly intended to be used, like if you have events that require a determined component tree to work and also creates a failproof use of a determined component.

For example if I have a card-list component and a card-list-item component with a delete button and I want the card-list-item component to be strictly nestable inside a card-list component so when I click the delete button an event is always fired in the parent component.

I know it's not an ultra required feature but it would be nice to have.

@javiercn
Copy link
Member

@rafaelchampion thanks for contacting us.

This is a duplicate issue of #12302. Closing this issue in favor of that one, please go ahead and up-vote that issue instead to help us track progress.

@javiercn javiercn added ✔️ Resolution: Duplicate Resolved as a duplicate of another issue area-blazor Includes: Blazor, Razor Components labels Mar 24, 2021
@ghost ghost added the Status: Resolved label Mar 24, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Apr 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

2 participants