You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's now a Twig Template for every HTML element included. These allow for better consistency in your design system(s), support all possible HTML attributes and have basic validations for enum attributes. They are compatible with different ways of using Twig (`include`, `embed` and `use`).
30
+
## Generated Templates
31
+
Templates are generated from the HTML5 schema for every HTML element. These allow for better consistency in your design system(s), support all possible HTML attributes and have basic validations for enum attributes.
32
+
Files are grouped into inline, block and void elements. For elements with a specific content model, a composed template is generated as well. (eg `<table><tr><td>Cell</td><tr></table>`)
33
+
34
+
### Twig
35
+
They are compatible with different ways of using Twig (`include`, `embed` and `use`).
32
36
```php
33
37
$twig->path('vendor/vardumper/extended-htmldocument/templates', 'html'); /** register template path with or without namespace */
Type-safe, auto-generated React components for all HTML5 elements with full ARIA support. Work in both Next.js (Server Components, Client Components) and regular React applications (CRA, Vite, etc.). They use pure functional React patterns without hooks or browser-specific APIs.
52
+
Example:
53
+
```tsx
54
+
import { Button, Div, H1 } from'./index';
55
+
56
+
exportdefaultfunction Page() {
57
+
return (
58
+
<DivclassName="container">
59
+
<H1>Welcome</H1>
60
+
<A
61
+
href="/contact"
62
+
>
63
+
Contact us
64
+
</A>
65
+
</Div>
66
+
);
67
+
}
68
+
```
69
+
70
+
### Storybook
71
+
72
+
45
73
## Documentation
46
74
See the [Documentation](https://vardumper.github.io/extended-htmldocument/) for more.
})->descriptions('Generates templates. Uses a given generator. Requires a Generator Name (eg. html, twig) and a destination path for the generated templates. You can also provide a list of generators separated by comma.', ['generator' => 'name of the generator(s)', 'dest' => 'destination path']);
Copy file name to clipboardExpand all lines: docs/code-generation.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@ php vendor/bin/ext-html make:classes a # only generates the Html\Element\Anchor
25
25
php vendor/bin/ext-html make:classes # generates all classes, no enums
26
26
php vendor/bin/ext-html make:all # generates both enums and classes
27
27
php vendor/bin/ext-html generate:all twig,storybook templates # generates all twig templates and storybook stories, and saved them into templates folder
28
+
php vendor/bin/ext-html generate:composed twig,storybook templates # generates composed templates based on content model (eg <table> with <tr>, <td>, etc), and saves them into templates folder
28
29
php vendor/bin/ext-html merge:specs custom/schema.yaml destination/path.yaml # merges a custom regex or element-based specification into the html5.yaml file
29
30
php vendor/bin/ext-html watch source/path dest/path # component builder. watches for component yaml changes, and generates templates on the fly
0 commit comments