DEV Community

Phil Pond
Phil Pond

Posted on

VueJS, Component Name as Prop?

Hi! Pretty new to vuejs.

Just wondering... I'm starting a project with some very simple components that don't do a whole lot; but they're wrappers to help keep things consistent. In some cases, adding a prop, when it might be the only one seems a bit wordy. Take a label, for instance:

works fine.

Here's My Text

also OK. But (slot) has no guardrails on what can go in.

What I'd really like is something like:

Is it possible? And are there reasons that it should not be done?

Top comments (0)