How to create some components with namespace like React.js

#1

Is it possible to have some components with namespace like React in Aurelia (vNext)?

In my opinion, this feature is great for increasing readability. (even better intellisense)

Card
Card.Header
Card.Body

Accordion
Accordion.Toggle
Accordion.Collapse

ReactJS components with namespace

1 Like
#2

Html is case insensitive, so you can only do:

<card>
  <card.header>

  </card.header>
  <card.body>

  </card.body>
</card>

or

<card>
  <card:header>

  </card:header>
  <card:body>

  </card:body>
</card>

Demo https://codesandbox.io/s/2vx4yrywlr

1 Like
#3

@bigopon In future, Is there any effect on intellisense? If we have the html intellisense on next version, Are these dots (separators) recognizable?

1 Like
#4

I’d prefer to have @fkleuver answer this. But short answer is yes

1 Like
#5

Bigopon,

Looking at your codesandbox I’ve never seen the use of static $resource() and static $view().
Is there somewhere which explains how these work? Also, how did Aurelia know to create custom elements <card.header> and <card:header> from the javascript Class’? Does it automatically do that for any required modules?

Thanks!

#6

@evanlarsen
Please check this blog post