Skip to content

What's the cool thing I will be able to do in maizzle 4.0 :) #639

Answered by cossssmin
weenzeel asked this question in Q&A
Discussion options

You must be logged in to vote

You can pass data through attributes to a component.

In that screenshot, article inside <component ... role="article"> is passed into the component, compiling role="{{ role }}" to role="article".

Might not be the best example since I used article for the component file name as well (article.html).

Here's a simpler component example:

<!-- button.html -->
<a href="{{ url }}">
  {{ label }}
</a>

If you'd use that like this:

<component
  src="button.html"
  url="https://example.com"
  label="Click me"
></component>

... it would compile to:

<a href="https://example.com">
  Click me
</a>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@HelloAlexPan
Comment options

@cossssmin
Comment options

Answer selected by weenzeel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants