Skip to main content

Button

HTML button with Switchboard link

Overview

The purpose of this component to create a button with the CTA text, bonus code, affiliate names, etc. into the copy on an HTML page and have it pull from the placement based on the provided props.

When used with pre-rendering, in the case where the client geolocated promo can’t be found, the original value that hydrated during the rendering will be preserved.

<bam-button
id="button4"
dev-mode="true"
placement-id="1172"
property-id="1"
location="FL"
field="title"
context="new-york-post-right-rail"
button-text="Click Me"
background="gray"
padding="20px 30px"
class="color-test"
>
</bam-button>

You can control specific styling of the link text using the ::part pseudo-class like:

<style>
.color-test::part(link) {
color: rgb(28, 28, 44);
}
</style>
<bam-button
id="button4"
dev-mode="true"
placement-id="1172"
property-id="1"
location="FL"
field="title"
context="new-york-post-right-rail"
button-text="Click Me"
background="gray"
padding="20px 30px"
class="color-test"
>
</bam-button>
SSR AvailableThis component is available for server side rendering.

Properties

PropertyAttributeDescriptionTypeDefault
affiliateaffiliatestringundefined
affiliateTypeaffiliate-typestringundefined
backgroundbackgroundThe background CSS value or use the value 'book' to use the book's default colorstringundefined
buttonTextbutton-textOverrides the default button/field textstringundefined
contextcontext(required)stringundefined
ctaTypecta-typestringundefined
deferdeferbooleanundefined
devModedev-modebooleanfalse
deviceTypedevice-type"android" | "desktop" | "ios" | "mobile"undefined
fieldfield"affiliate-name" | "affiliate-terms" | "affiliate_name" | "affiliate_terms" | "bonus" | "cta" | "term" | "terms" | "title"undefined
gameIdgame-idnumberundefined
initialValueinitial-valuestring''
internalIdinternal-idstringundefined
isBetsyncUseris-betsync-userbooleanundefined
isMobileis-mobilebooleanundefined
leagueleaguestringundefined
locationlocationstringundefined
moduleTitlemodule-titlestringundefined
paddingpaddingOverride the default padding with a CSS value. Default is '--bam-spacing-small --bam-spacing-medium'.stringundefined
pageSlugpage-slugstringundefined
placementIdplacement-id(required)numberundefined
propertyIdproperty-id(required)numberundefined
subdivisionsubdivisionnumberundefined
subscriptionTiersubscription-tier0 | 1 | 2 | 3undefined
underlineunderlinebooleanfalse
wasProwas-probooleanundefined

Shadow Parts

PartDescription
"button"
"link"