.html file in Aero is a template. The same syntax — { } expressions, directives, <script is:build> — works in all of them. The difference is where the file lives and what role it plays:
| Role | Directory | Purpose |
|---|---|---|
| Page | client/pages/ | Becomes a URL via file-based routing |
| Component | client/components/ | Reusable markup, imported into pages and layouts |
| Layout | client/layouts/ | Shared page shell with <slot /> for content |
Pages
Every.html file in client/pages/ becomes a route. index.html maps to /, about.html maps to /about. See Routing for dynamic routes and getStaticPaths.
client/pages/about.html
Components
Components are.html files in client/components/. Import one in a <script is:build> block and use it as a custom element:
client/components/greeting.html
client/pages/index.html
Import without the
.html extension: import greeting from '@components/greeting'
resolves to client/components/greeting.html.Props
Pass data to a component via attributes. Use{ } for dynamic values:
Aero.props:
props="{ ...obj }" to pass every key as a separate prop:
/>) when a component has no slot content. Use opening and closing tags to pass children into its <slot>:
Layouts
Layouts are.html files in client/layouts/ that wrap page content. Use <slot /> to mark where the content goes:
client/layouts/base.html
client/pages/about.html
Nested layouts
A layout can use another layout. Content flows from page to inner layout to outer layout:client/layouts/docs.html
Named slots
Define named slots with thename attribute. Pages target them with slot:
client/layouts/base.html
client/pages/home.html
Expressions
Wrap any JavaScript expression in single braces to interpolate it into text or attributes:raw() for intentional unescaped HTML:
Loops
Usefor (or data-for) with a for…of expression to repeat an element:
index, first, last, and length as automatic variables.
Conditionals
Useif, else-if, and else as attributes:
Switch / case
Match a value against multiple alternatives:Wrapperless output with <template>
Put a directive on <template> to emit only the children without a wrapper element:
if, for, and switch. It is especially useful inside <table> or <select> where an extra <div> would be invalid.
All directive attributes also accept a
data- prefix for strict HTML spec compliance:
data-for, data-if, data-else, etc.