Replies: 1 comment
-
For some added color, here is a proof of concept that shows what I am currently doing. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I'm really enjoying
@headlessui/vue
and am starting to feel the familiar CSS class "copy+paste" friction.Outside of Headless UI, when I feel this friction (usually after the 2nd or 3rd occurrence of a UI pattern, I simply extract that concept into a component, wire any behaviour I need and keep on moving. Using
<Menu>
as an example, I desire to have a common styling for Menus across the application and currently am simply using the component straight from here and applying my own styling; being careful to make sure it is the same in 8-9 different places. I would like to extract a<Menu>
component local to my project that "extends" or "wraps" the Headless UI version.So I end up with a project structure like this:
These are components owned by my application and more or less basically wrap the Headless UI versions, apply appropriate CSS classes, additional markup, and slots for nesting other components that wrap Headless UI ones. For example, my
MenuItem
component accepts anicon
property that is used to load an appropriate Heroicon to the left of the Menu Item.This kinda works but... I feel like there must be another way. So... I'm curious what others are doing!
My end-goal is to be able to write markup that looks like:
And is presented like:
Am I way off-base or is there a better way?
Beta Was this translation helpful? Give feedback.
All reactions