docs(clickable-tile): add "Prevent default behavior" example

This commit is contained in:
Eric Liu 2022-03-19 07:17:18 -07:00
commit a3218b223f

View file

@ -13,6 +13,20 @@ source: Tile/ClickableTile.svelte
Carbon Design System Carbon Design System
</ClickableTile> </ClickableTile>
### Prevent default behavior
Use the forwarded `click` event and invoke `e.preventDefault()` to prevent the native link behavior.
<ClickableTile
href="/"
on:click={(e) => {
e.preventDefault();
// custom behavior
}}
>
Carbon Design System
</ClickableTile>
### Light variant ### Light variant
<ClickableTile light href="https://www.carbondesignsystem.com/"> <ClickableTile light href="https://www.carbondesignsystem.com/">