How to use this component
Basic use (<button>
)
<Hds::Interactive>
your content here (will be yielded)
</Hds::Interactive>
In this case, since no @href
or @route
argument is provided it will generate in output an HTML <button>
element.
With @href
parameter (<a>
)
If an @href
argument is provided:
<Hds::Interactive @href="https://google.com">
your content here
</Hds::Interactive>
it will generate in output an HTML <a>
link element with target="_blank"
and rel="noopener noreferrer"
attributes.
If an @isHrefExternal
argument is provided with false
value:
<Hds::Interactive @href="#your-local-anchor-id" @isHrefExternal=>
your content here
</Hds::Interactive>
it will generate in output an HTML <a>
link element without the HTML target
and rel
attributes.
With @route
parameter (<LinkTo>
/<LinkToExternal>
)
If a @route
argument is provided:
<Hds::Interactive @route="components" >
your content here
</Hds::Interactive>
it will generate in output a <LinkTo>
component.
If the @route
is external to the current engine (more details here), you need to provide an extra @isRouteExternal
parameter:
<Hds::Interactive @route="components" @isRouteExternal= >
your content here
</Hds::Interactive>
and it will generate in output a <LinkToExternal>
component.
All the standard arguments for the <LinkTo/LinkToExternal>
components are supported (eg. models
, model
, query
, current-when
, replace
). For more details about these parameters see the Ember documentation or the LinkTo component API specs.
Component API
- Name
-
href
- Description
-
This is the URL parameter that is passed down to the
<a>
element.
- Name
-
isHrefExternal
- Type
-
boolean
- Values
-
- false (default)
- true
- Description
-
This controls if the
<a>
link is external and so for security reasons we need to add thetarget="_blank"
andrel="noopener noreferrer"
attributes to it.
- Name
-
route models model query current-when replace
- Description
-
These are the parameters that are passed down as arguments to the
<LinkTo>
/<LinkToExternal>
components.
- Name
-
isRouteExternal
- Type
-
boolean
- Values
-
- false (default)
- true
- Description
-
This controls if the "LinkTo" is external to the Ember engine (more details here) in which case it will use a
<LinkToExternal>
instead of a simple<LinkTo>
for the @route.
- Name
-
…attributes
- Description
-
...attributes
spreading is supported on this component.