How to reuse and compose shapes within the same file #2014
Unanswered
sonicsmooth
asked this question in
Q&A
Replies: 1 comment 4 replies
-
vars can do this. unless i'm misunderstanding, this is the same issue as #1891 (comment) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'd like to be able to reuse a hierarchy of shapes:
For example:
should result in
![image](https://private-user-images.githubusercontent.com/672429/351478164-0d898013-f676-47b1-9da6-7382d0aa8bce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2NjgxNDksIm5iZiI6MTczOTY2Nzg0OSwicGF0aCI6Ii82NzI0MjkvMzUxNDc4MTY0LTBkODk4MDEzLWY2NzYtNDdiMS05ZGE2LTczODJkMGFhOGJjZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNlQwMTA0MDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lNTI3ODljOGZlNjIwNDFmNzU1YjA1YmM2ZTI5Y2FlYTkxNjI3NjhmZDkzOGI0ZjJkY2MwMDdjN2IxZTgzN2RlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.xsSBUtzDZeIKKx18S2m9lzpW7jK6WLiQOHg8w0AkNVM)
I can do this by defining mycomponent in another file and then using ...@filename, but I'd like to keep the component definition in the main file.
It seems like classes can be used to compose properties and styles, but not shapes.
eg https://github.com/terrastruct/d2/discussions/1087
This doesn't work:
It seems like vars can't contain shapes.
Perhaps I'm missing something obvious with these.
thanks
Beta Was this translation helpful? Give feedback.
All reactions