Components
Button
Play around with props, edit and copy code.
Theming
Button support theming through css custom properties (sometimes referred to as CSS variables or cascading variables). If no custom properties are set, the default colors will be used.
You can either set the custom properties in the :root {...}
of your css or on a class if you only want to apply a theme to a specific area or node (DOM) of the page.
Examples
Three different sized and themes buttons.
*This is only examples to demonstrate how the theming works and not something that is used on any of Svenska Spel's websites.
Code
// React code
<div className="btn-theme-example-1">
<Button inverted size={700}>Themed primary size 700</Button>
<Button transparent size={500}>Themed transparent size 500</Button>
<Button focus rounded>Themed cta rounded</Button>
</div>
// CSS code
.btn-theme-example-1 {
// Primary
--btn-primary: blue;
--btn-on-primary: white;
--btn-primary-hover: #2525f5;
--btn-on-primary-hover: white;
--btn-primary-active: #03039d;
--btn-on-primary-active: white;
// Transparent
--btn-transparent: orange;
--btn-on-transparent: orange;
--btn-transparent-hover: #bb7c01;
--btn-on-transparent-hover: #bb7c01;
// CTA
--btn-cta: linear-gradient(45deg, rgba(0,196,181,1) 0%, rgba(78,32,77,1) 50%);
--btn-on-cta: white;
--btn-cta-hover: linear-gradient(45deg, rgba(0,196,181,1) 0%, rgba(78,32,77,1) 80%);
--btn-on-cta-hover: white;
--btn-cta-active: linear-gradient(45deg, rgba(0,196,181,1) 0%, rgba(78,32,77,1) 30%);
--btn-on-cta-active: white;
display: flex;
gap: 6px;
align-items: center;
}
CSS custom properties (variables)
Primary button
Known as ìnverted
in our system.
Custom property name | Description | Default value |
---|---|---|
--btn-primary | Background | @navy |
--btn-on-primary | Text color | @white |
--btn-primary-hover | Background: Hover state | lighten(@navy, 5%); |
--btn-on-primary-hover | Text: Hover state | @white |
--btn-primary-active | Background: Active state | darken(@navy, 5%); |
--btn-on-primary-active | Text: Active state | @white |
--btn-primary-disabled: | Background: Disabled state | @grey-400; |
--btn-on-primary-disabled | Text: Disabled state | @grey-300; |
Focused/CTA button
Known as focus
or green
in our system.
Custom property name | Description | Default value |
---|---|---|
--btn-cta | Background | @green / @sport |
--btn-on-cta | Text color | @white |
--btn-cta-hover | Background: Hover state | lighten(@green/@sport, 5%); |
--btn-on-cta-hover | Text: Hover state | @white |
--btn-cta-active | Background: Active state | darken(@green/sport, 5%); |
--btn-on-cta-active | Text: Active state | @white |
--btn-cta-disabled: | Background: Disabled state | #d2efd5 |
--btn-on-cta-disabled | Text: Disabled state | @white |
Ghost button
Known as clean
in our system.
Custom property name | Description | Default value |
---|---|---|
--btn-ghost | Background | transparent |
--btn-on-ghost | Text color | @blue |
--btn-ghost-hover | Background: Hover state | @grey-100 |
--btn-on-ghost-hover | Text: Hover state | @blue |
--btn-ghost-active | Background: Active state | @grey-200 |
--btn-on-ghost-active | Text: Active state | @blue |
--btn-ghost-disabled: | Background: Disabled state | transparent |
--btn-on-ghost-disabled | Text: Disabled state | @grey-300 |
Transparent button
Known as secondary
in our system.
Custom property name | Description | Default value |
---|---|---|
--btn-transparent | Border color | @navy |
--btn-on-transparent | Text color | @navy |
--btn-transparent-hover | Inner box shadow | @navy |
--btn-on-transparent-hover | Text color | |
--btn-transparent-active | Inherits from default | |
--btn-on-transparent-active | Inherits from default | |
--btn-transparent-disabled | Border: Disabled state | lighten(@grey-600, 20%); |
--btn-on-transparent-disabled | Text: Disabled state | lighten(@grey-600, 20%); |
Properties
Button
Prop name | Type | Default Value | Description |
---|---|---|---|
block | bool | false | Set true to get a full width button. Perfect for buttons placed in Grid. |
circle | bool | false | Set to true for a circular button. |
className | string | '' | Custom classes |
Component | node | 'button' | Button is the default node type. |
elemRef | object | null | |
focus | bool | false | Set true for a CTA button. |
ghost | bool | false | Set true for a ghost button |
inverted | bool | false | Set true for a primary button. Set false for a primary button on dark surfaces. |
size | union | 300 | 300 is default. 100 small button |
thin | bool | false | Use thin borders. May only be used by Svenska Spel Sport & Casino |
transparent | bool | false | Set true for a secondary button Combine with inverted true on dark surfaces for secondary button. |
type | enum | 'button' | Use submit for forms. |
children * | node | Content. | |
disabled | bool | Set true to get a disabled button | |
doubleLines | bool | Usen in tight areas where the content in a button needs to be placed on two lines. | |
href | string | Add href to turn button in to a <a-tag. | |
iconPosition | enum | Position of icon. | |
onClick | func | Run callback function on click. | |
rounded | bool | Set true for a rounded button |
Accessibility
This component has been validated to meet the WCAG 2.1 AA accessibility guidelines.