mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
docs(clickable-tile): add "Prevent default behavior" example
This commit is contained in:
parent
ceb7abf2e9
commit
a3218b223f
1 changed files with 14 additions and 0 deletions
|
@ -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/">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue