Select to view content in your preferred language

How to create a calcite button that looks like a link?

1121
4
Jump to solution
07-03-2024 12:05 PM
ForrestLin
Frequent Contributor

How to create a calcite button that looks like a link?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
KittyHurley
Esri Contributor

@ForrestLin You can use CSS to fit your use case, perhaps something like: https://codepen.io/geospatialem/pen/gONOLVG 

<style>
  calcite-button[href] {
    --calcite-color-brand: var(--calcite-color-text-link);
    text-decoration: underline solid var(--calcite-color-text-link);
  }
</style>

<calcite-button appearance="transparent" href="https://developers.arcgis.com/calcite-design-system/components/button">Button with a link</calcite-button>
<calcite-button>Button with no link</calcite-button>

View solution in original post

0 Kudos
4 Replies
KittyHurley
Esri Contributor

@ForrestLin You can use CSS to fit your use case, perhaps something like: https://codepen.io/geospatialem/pen/gONOLVG 

<style>
  calcite-button[href] {
    --calcite-color-brand: var(--calcite-color-text-link);
    text-decoration: underline solid var(--calcite-color-text-link);
  }
</style>

<calcite-button appearance="transparent" href="https://developers.arcgis.com/calcite-design-system/components/button">Button with a link</calcite-button>
<calcite-button>Button with no link</calcite-button>
0 Kudos
ForrestLin
Frequent Contributor

@KittyHurley 

Thank you!

0 Kudos
ACrateau
Occasional Contributor

@KittyHurley  Is it possible to use the same logic to increase the default font size and weight of a button's text?    I'm trying the same approach you provided here and adding the CSS properties font-weight and font-size, but the renderer is ignoring them - any thoughts?

0 Kudos
KittyHurley
Esri Contributor

@ACrateau Yes, you can do so using the --calcite-font-size-relative-base and --calcite-font-weight-normal (deprecated) tokens: https://codepen.io/geospatialem/pen/ZYpayqW.

#custom-btn {
    --calcite-font-size-relative-base: var(--calcite-font-size-relative-lg);
  /* Note that --calcite-font-weight-normal is deprecated, but still supported in Button */
  --calcite-font-weight-normal: var(--calcite-font-weight-bold);
}

While --calcite-font-weight-normal is supported it is deprecated, but the team is working on support for the replacement --calcite-font-weight-regular token soon. Additional information can be sought and followed via issue #14190.

0 Kudos