x-magic and x-directive #2562
JeremyJaydan
started this conversation in
3. Feature Ideas
Replies: 1 comment 1 reply
-
It's already possible to define magic helpers and directives in a script tag so I'm not sure if that improves the DX. In your example, the magic helper and new directive are not called in the same component where they are defined which is a bit odd. If they are not scoped, it will be hard to explain to other devs: if you define a directive that way and you use the directive before that component, it will break and people will raise a lot of bug reports. Another observation is that a custom directive is likely to have several lines of code which won't be too readable on an html tag. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
An
x-magic
andx-directive
directive could be useful shortcuts for drop-in components.With this magic directive example, there could be a magic
$modal
function that takes in arguments for the modal to show.Modal Example
Another example is a notification system for user events that could be registered as a magic
$feedback
function to show messages.Feedback Example
With the directive directive, an example could be a dropdown component using an
x-toggle
directive.Dropdown Example
Another directive example could be an
x-tooltip
directive for easily customizable tooltips.Tooltip Example
Above are just examples (haven't tested them).
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions